40const char *
opensql(
const char *dbname,
const char **table)
42 const char *
host = (
char *) 0;
43 unsigned long port = 0L;
44 const char *db = (
char*)
"ezmlm";
45 const char *
user = (
char *) 0;
46 const char *pw = (
char *) 0;
51 if (
fn.len == ourdb.len && !str_diffn(ourdb.s,
fn.s,
fn.len)) {
53 if (*table) ourtable = *table;
54 else *table = ourtable;
62 switch (openreadclose(
fn.s,&myp,128)) {
71 if (!stralloc_append(&myp,
"\n"))
return ERR_NOMEM;
73 for (j=0; j < myp.len; ++j) {
74 if (myp.s[j] ==
'\n') { myp.s[j] =
'\0';
break; }
79 if (myp.s[j = str_chr(myp.s,
':')]) {
83 if (myp.s[j += str_chr(myp.s+j,
':')]) {
86 if (myp.s[j += str_chr(myp.s+j,
':')]) {
89 if (myp.s[j += str_chr(myp.s+j,
':')]) {
92 if (myp.s[j += str_chr(myp.s+j,
':')]) {
102 if (pw && !*pw) pw = (
char *) 0;
103 if (db && !*db) db = (
char *) 0;
104 if (ourtable && !*ourtable) ourtable = (
char *) 0;
107 if (*table) ourtable = *table;
108 else *table = ourtable;
113 if (!(
mysql = mysql_init((MYSQL *) 0)))
116 (
unsigned int) port, 0, CLIENT_COMPRESS)))
117 return mysql_error(
mysql);