#include #include #include #include "mysql.h" #include MYSQL *mysql; MYSQL_STMT *stmt; static char *server_options[] = { "mysql_test", "--defaults-file=/home/sveta/SharedData/web_project/MySQL/bugs/bug70664.cnf" }; int num_elements = sizeof(server_options)/ sizeof(char *); static char *server_groups[] = { "mysqld", "client" }; int main(void) { int err = mysql_server_init(num_elements, server_options, server_groups); mysql = mysql_init(NULL); mysql_options(mysql, MYSQL_READ_DEFAULT_GROUP, "client"); mysql_options(mysql, MYSQL_OPT_USE_EMBEDDED_CONNECTION, NULL); mysql_real_connect(mysql, NULL,NULL,NULL, "test", 0,NULL,0); char sql[] ="select version()"; stmt= mysql_stmt_init(mysql); mysql_stmt_prepare(stmt, sql, strlen(sql)); if (mysql_stmt_execute(stmt)) printf("failed to execute stmt:%s\n", mysql_stmt_error(stmt)); mysql_close(mysql); mysql_server_end(); return 0; }