43 unsigned long *lengths;
44 char *table =
"ezmlm";
45 char *sublistname = (
char *) 0;
50 if (
listno.len)
return (
char *) 0;
57 if ((ret =
opensql(
dir,&table,&sublistname)))
return ret;
64 strnum[fmt_ulong(strnum,
msgnum)] =
'\0';
72 if (!stralloc_copys(&line,
"SELECT listno FROM "))
return ERR_NOMEM;
73 if (!stralloc_cats(&line,table))
return ERR_NOMEM;
74 if (!stralloc_cats(&line,
"_name WHERE name='"))
return ERR_NOMEM;
75 len = str_len(sublistname);
79 if (!stralloc_cats(&line,
"' AND notuse = 0 AND ("))
return ERR_NOMEM;
80 if (!stralloc_cats(&line,strnum))
return ERR_NOMEM;
81 if (!stralloc_cats(&line,
" BETWEEN msgnum_lo AND msgnum_hi)"
82 " ORDER BY listno LIMIT 1"))
return ERR_NOMEM;
84 if (mysql_real_query((MYSQL *)
psql,line.s,line.len) != 0)
85 return mysql_error((MYSQL *)
psql);
87 if (!(result = mysql_use_result((MYSQL *)
psql)))
88 return mysql_error((MYSQL *)
psql);
90 if (!(row = mysql_fetch_row(result))) {
91 if (!mysql_eof(result))
92 return mysql_error((MYSQL *)
psql);
99 if (!(lengths = mysql_fetch_lengths(result)))
100 return mysql_error((MYSQL *)
psql);
102 mysql_free_result(result);