If it is as you say then your cpp is broken in a way that I've never seen any cpp being broken. A suggestion is to trace the scope of the definition by inserting
#ifdef MYSQL_READ_DEFAULT_FILE #error foo #endif
here and there.
/ Martin Stjernholm, Roxen IS
Previous text:
2003-02-19 01:51: Subject: Mysql
I just found a bug in Pike under Solaris. I changed the layout of my mysql installation a bit and therefor I had to put some new options in my /etc/my.cnf. Since I want my pike-applications to use that file for the defaults, I tried
object o = Sql.sql("mysql://localhost/db", ([ "mysql_config_file":"/etc/my.cnf" ]));
which should give me access to the database. Instead I get a backtrace. After some investigation, I've found the following in modules/Mysql/mysql.c:
static void pike_mysql_set_options(struct mapping *options) { struct svalue *val;
#ifdef HAVE_MYSQL_OPTIONS #ifdef MYSQL_READ_DEFAULT_FILE if ((val = simple_mapping_string_lookup(options, "mysql_config_file")) && (val->type == T_STRING) && (!val->u.string->size_shift)) { printf("READING MYSQL-DEFAULTS..."); mysql_options(PIKE_MYSQL->mysql, MYSQL_READ_DEFAULT_FILE, val->u.string->str); } #endif
...
#endif
The code above is where Pike indeed does load the my.cnf file. After inserting a few printfs I concluded that the second ifdef statement is false and thus the code within the inner ifdefs doesn't execute. MYSQL_READ_DEFAULT_FILE & Co are defined within mysql.h from the MySQL source within an enum construction. If I try to print the value of it using a printf, it shows that MYSQL_READ_DEFAULT_FILE==4.
So, what causes all the inner ifdefs in pike_mysql_set_options() to fail? Right now I'm using one of the latest Pike 7.3 from CVS and a mysql 4.0.10-gamma server.
/ Marcus Agehall (Trådlös)