Re: How to compile the libmysqld.dll from the source code?
We just purchased MySQL to deeply embed it in a C++ application. I am confused by your message. I was told by your salesperson and the MySQL Enterprise that I downloaded includes what appears to be required to embed version 5.0. Please clarify.
Additionally, I have been unable to build and execute any of the samples or demos I find on this site or any other. With the following code:
#include "mysql.h"
MYSQL *mysql; //the embedded server class
MYSQL_RES *results; //stores results from queries
MYSQL_ROW record; //a single row in a result set
static char *server_options[] = {"mysql_test",
"--defaults-file=c:\\mysql_embedded\\my.ini",
"--datadir=c:\\mysql_embedded\\data" };
int num_elements=sizeof(server_options) / sizeof(char *);
static char *server_groups[] = {"libmyswld_server", "libmysqld_client" };
int main(void)
{
if (mysql_server_init(num_elements, server_options, server_groups)) {
printf("There was an error! Error number : %d = %s\n",
mysql_errno(mysql), mysql_error(mysql));
}
if(!(mysql = mysql_init(NULL))) {
printf("There was an error! Error number : %d = %s\n",
mysql_errno(mysql), mysql_error(mysql));
}
mysql_options(mysql, MYSQL_READ_DEFAULT_GROUP, "libmysqld_client");
mysql_options(mysql, MYSQL_OPT_USE_EMBEDDED_CONNECTION, NULL);
if (mysql_real_connect(mysql, NULL, NULL, NULL, "information_schema",
0, NULL, 0)) {
printf("There was an error! Error number : %d = %s\n",
mysql_errno(mysql), mysql_error(mysql));
}
if (mysql_query(mysql, "SHOW DATABASES;")) {
printf("There was an error! Error number : %d = %s\n",
mysql_errno(mysql), mysql_error(mysql));
}
I get an error 2006, MySQL server has gone away from the query function. Any suggestions would be very helpful.