Thanks for the comments.

I would suggest it may be easier to do most of those things in perl.

> Five programs (or modes to one program, depending on your mood):
> mysqlGetOne: Returns the first field of the first record in the resultset.
use LIMIT 1
> mysqlQuery: Returns nothing, merely running the query (equivalent to mysql
> -e).
-d for dummy run. returns only exit status.

> mysqlGetRow: Returns a {CSV,TSV} of the {first,nth} row in the resultset.
select a different column, LIMIT 1, OFFSET n

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

> mysqlGetQuery: Returns a {CSV,TSV} of the entire resultset.
no limits on the query.

Current the result set if returned tab seperated, as I believed that nobody 
would want data containing a tab in it.  Adjusting the program to return all 
rows is probably a smart idea, and your scripts should be written to work 
with that.  Currently I'm only returning one row.

> (Sorted by my personal preference as to which is most important, but others
> will no doubt have their own ordering).
That's what the SQL query is for, sort how you like :)  you can ORDER BY 
rand() if you like :)

>
> You'd either have to parse a config file, or allow a million options on the
> command line.  Bugger.
I would suggest most of these options could be done by sql query.  But if 
there are ones that are not, I'm willing to discuss them further.

>
> 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.
well, the program basically runs and sql query and returns a result.  that's 
about as generic as I can think to make it, you can then do what you like 
with it.  substitue in variable and get all sorts of information.  The output 
format is up for grabs though I think.  I like tab seperated, as there are no 
quoting issues, and I can't think of a reason you would want a tab in this 
data.

I did statically link the binary, and it's 1.5meg.  It gets loaded from the 
linuaux share so there is no need to hack the image used by unattended.

Regards

Russell Smith.


-------------------------------------------------------
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