MUD Driver

Jump to: navigation, search

FluffOS Downloads:

Also check:

Missing Libraries[ ]

Check that system_libs include has -lpthread and -lz if you are getting missing function errors (gzip and pthread_create)

Adding MySQL Support to MudOS/FluffOS[ ]

open up packages/db.c and look around line 688 inside the MySQL_connect function:

You can skip these source edits in Fluffos 2.24.

Change this:

  int ret;
  MYSQL *tmp;
  tmp = ALLOCATE(MYSQL, TAG_DB, "MySQL_connect");
  *(c->mysql.errormsg) = 0;
  c->mysql.handle = mysql_connect(tmp, host, username, password);

To this:

   int ret;
   MYSQL *tmp;
   tmp = ALLOCATE(MYSQL, TAG_DB, "MySQL_connect");
   tmp = mysql_init(tmp);
   *(c->mysql.errormsg) = 0;
   c->mysql.handle = mysql_real_connect(tmp, host, username, password, database, 0, MYSQL_SOCKET_ADDRESS, 0);
   //c->mysql.handle = mysql_connect(tmp, host, username, password);

Then, inside MySQL_fetch change this:

                       v->item[i].type = T_BUFFER;
                       v->item[i].u.buf = allocate_buffer(field->length);
                       write_buffer(v->item[i].u.buf, 0, target_row[i], field->length);

To this:

                       v->item[i].type = T_BUFFER;
                       v->item[i].u.buf = allocate_buffer(field->max_length);
                       write_buffer(v->item[i].u.buf, 0, target_row[i], field->max_length);

Run a mysql_config command, this will return something like:

       --cflags         [-I/usr/include/mysql -fmessage-length=0 -D_FORTIFY_SOURCE=2 -g -DPIC -fPIC -DUNDEF_HAVE_INITGROUPS -fno-strict-aliasing]
       --include        [-I/usr/include/mysql]
       --libs           [-L/usr/lib64/mysql -lmysqlclient -lz -lcrypt -lnsl -lm]
       --libs_r         [-L/usr/lib64/mysql -lmysqlclient_r -lz -lpthread -lcrypt -lnsl -lm -lpthread]
       --socket         [/var/lib/mysql/mysql.sock]
       --port           [3306]
       --version        [5.0.26]
       --libmysqld-libs [-L/usr/lib64/mysql -lmysqld -lz -lpthread -lcrypt -lnsl -lm -lpthread -lwrap -lrt]

copy the contents of the --libs to system_libs file (note: it will be removed if you do a make spotless)

In local_options you should have the following defines:

#define PACKAGE_DB
#undef USE_MSQL 1
#define USE_MYSQL 2
#define MYSQL_SOCKET_ADDRESS    "/tmp/mysql.sock"

In edit_source.c there will be a line like this, you should make sure the path to mysql.h matches the path in the --include output of mysql_config above.

|| check_include("INCL_MYSQL_MYSQL_H", "/usr/include/mysql/mysql.h"))) {