On Thu, Jun 17, 2004 at 08:46:48AM +1000, Russell Smith wrote:
> I wrote to the list recently about using a couple of C programs instead of DBI 
> to connect to a database.  Is this a feasible option, or do we want to go 
> down the DBI path, which seems to have been discussed for months, but we 
> haven't been able to implement.
> 
> I have stage one running (mysql static binary) which queries from the database 
> and loads results.  It is not the fastest solution in the world as it 
> reconnects to the database each time you run a query with it, but that it 
> still not particularly slow.
> 
> I am looking for comments on this before I develop this further.

Personally, I think it's a killer idea, because DBI appears to be a major
PITA, and with a nice statically (or even semi-statically linked -- put
libmysqlclient in, but leave glibc for dynamic linking) linked program, all
your library woes are at an end.

> Currently I sent the program an SQL query and it returns 1 line.  This can be 
> easily changed and expanded, but I would like to know what people are after?

Five programs (or modes to one program, depending on your mood):

mysqlGetOne: Returns the first field of the first record in the resultset.

mysqlQuery: Returns nothing, merely running the query (equivalent to mysql
-e).

mysqlGetRow: Returns a {CSV,TSV} of the {first,nth} row in the resultset.

mysqlGetCol: Returns a {CSV,TSV} of the {first,nth} column in the resultset.

mysqlGetQuery: Returns a {CSV,TSV} of the entire resultset.

(Sorted by my personal preference as to which is most important, but others
will no doubt have their own ordering).

You'd either have to parse a config file, or allow a million options on the
command line.  Bugger.

In fact, thinking about it, if you could produce a statically-linked mysql
client binary, with appropriate shell or perl scripting, you could produce
all of those programs.  Messy, almost certainly, because the way the mysql
monitor client prints result sets is crap, but might be worth a go.

- Matt


-------------------------------------------------------
This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA
REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND
_______________________________________________
unattended-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/unattended-devel

Reply via email to