W3C home > Mailing lists > Public > www-lib@w3.org > October to December 2003

HTSQL and MySQL Problems

From: OTR Comm <otrcomm@isp-systems.com>
Date: Tue, 04 Nov 2003 22:37:01 -0700
Message-ID: <3FA88C7D.95C1DC61@isp-systems.com>
To: www-lib@w3.org

Hello,

I am new to libwww, but want to work on using libwww to interface to
MySQL.

I downloaded w3c-libwww-5.4.0 and finally got it to compile with
mysql-4.0.15.

I had to modify HTSQL.c, HTSQL.h, and HTSQLLog.c in the Library/src
directory.

The diffs are below:

[root@commspeed libwww]# diff HTSQL.c.new HTSQL.c.orig
21,22c21,22
< #include </usr/local/mysql/include/mysql/mysql.h>
< #include </usr/local/mysql/include/mysql/errmsg.h>
---
> #include <mysql/mysql.h>
> #include <mysql/errmsg.h>
185c185
<       if ((me->psvr = mysql_real_connect(&(me->server), me->host,
---
>       if ((me->psvr = mysql_connect(&(me->server), me->host,
187c187
<                                     me->password ? me->password :
"","",0,0,0)) == NULL) {
---
>                                     me->password ? me->password : "")) == NULL) {
232,233d231
<       char query[1024];
< 
245,246c243
<               sprintf (query, "CREATE DATABASE %s", db);
<               if (mysql_query(me->psvr, query) != 0) {
---
>               if (mysql_create_db(me->psvr, db) < 0) {

*********************************************************

[root@commspeed libwww]# diff HTSQL.h.new HTSQL.h.orig
34c34
< #include </usr/local/mysql/include/mysql/mysql.h>
---
> #include <mysql/mysql.h>

*********************************************************

[root@commspeed libwww]# 
[root@commspeed libwww]# diff HTSQLLog.c.new HTSQLLog.c.orig
20c20
< #include </usr/local/mysql/include/mysql/mysql.h>
---
> #include <mysql/mysql.h>

*********************************************************

mysql_connect and mysql_create_db are not supported in MySQL-4, and I
kept getting errors about undefined references to mysql_connect and
mysql_create_db until I modified HTSQL.c, HTSQL.h, and HTSQLLog.c.

I never could get the includes to work without the full path to the
headers mysql.h and errmsg.h, and the full path was the lazy way out :)


Since I installed MySQL in /usr/local/mysql,

I configured libwww with:

./configure --with-gnu-ld
--with-mysql=/usr/local/mysql/lib/mysql/libmysqlclient.a

I have never used libwww before, so if anyone has used libww with MySQL,
I would like some pointers on how to create linked lists from table
records.  I have close to a million records of FQDs and URLs in MySQL
that I want to pull once into a linked list in a program space and
search the list during program execution instead of going back to MySQL
with queries.

Ultimately this will be a modification to squidGuard if anyone is
familiar with the squid/squidGuard web content filtering system.

Another thing that I need help with is how to use libwww to escape
illegal characters in URLs.

Hope this helps someone else,
Murrah Boswell
Received on Wednesday, 5 November 2003 00:37:17 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 5 February 2014 23:39:35 UTC