dbTalk Databases Forums  

Mysql::Simple

mailing.database.msql-mysql-modules mailing.database.msql-mysql-modules


Discuss Mysql::Simple in the mailing.database.msql-mysql-modules forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Dan Bolser
 
Posts: n/a

Default Mysql::Simple - 09-17-2004 , 12:12 PM







I have made a perl module called Mysql::Simple which parses /etc/my.cfg
and ~.my.cfg to set up Mysql connection parameters. In case it dosn't find
a password it uses Term::ReadPassword to get the user to supply one.

It uses use Getopt::Long to read mysql style options (in passthrough
mode).

Finally it provides a simple interface, allowing you to code things like
the following (but not much else)...

#!/usr/bin/perl

use Mysql::Simple qw( doQuery );

$x = doQuery( <your sql here> ) or die "$DBI::errstr\n";

for (@$x){
print join("\t", @$_), "\n";
}

__END__

Quite simple eh?

I am looking for feedback, and perhaps a volunteer to help make this a
proper CPAN module.

The befifit of this module is never writing another connection string, and
not worrying about where to put your password.

It needs work on the range of mysql command line options supported and for
prepared queries (which it does support). The docs need some work.




--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=ms...ie.nctu.edu.tw


Reply With Quote
  #2  
Old   
Rudy Lippan
 
Posts: n/a

Default Re: Mysql::Simple - 09-17-2004 , 12:19 PM






On Fri, 17 Sep 2004, Dan Bolser wrote:

Quote:
I have made a perl module called Mysql::Simple which parses /etc/my.cfg
and ~.my.cfg to set up Mysql connection parameters. In case it dosn't find
For this part you can just pass in mysql_read_default_group (there is some
code in CVS that will causes DBD::mysql to default to reading the group
"dbd_mysql" if the no group is passed in)


Rudy.


--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=ms...ie.nctu.edu.tw



Reply With Quote
  #3  
Old   
Dan Bolser
 
Posts: n/a

Default Re: Mysql::Simple - 09-17-2004 , 12:23 PM




I found a bug in this function on old versions.

Also it makes the connection string look ugly (and I never like to look at
it anyway (I have a week stomach)). Also can you supply multiple files?

Thanks for the comments.

Would / could you use such a cpan module?

Cheers,
Dan.

On Fri, 17 Sep 2004, Rudy Lippan wrote:

Quote:
On Fri, 17 Sep 2004, Dan Bolser wrote:

I have made a perl module called Mysql::Simple which parses /etc/my.cfg
and ~.my.cfg to set up Mysql connection parameters. In case it dosn't find

For this part you can just pass in mysql_read_default_group (there is some
code in CVS that will causes DBD::mysql to default to reading the group
"dbd_mysql" if the no group is passed in)


Rudy.


--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=ms...ie.nctu.edu.tw



Reply With Quote
  #4  
Old   
Jeremy Zawodny
 
Posts: n/a

Default Re: Mysql::Simple - 09-17-2004 , 02:19 PM



On Fri, Sep 17, 2004 at 06:17:24PM +0100, Dan Bolser wrote:
Quote:
I have made a perl module called Mysql::Simple which parses /etc/my.cfg
and ~.my.cfg to set up Mysql connection parameters. In case it dosn't find
a password it uses Term::ReadPassword to get the user to supply one.
Can I suggest a naming change? MySQL::Simple instead of Mysql? Since
MySQL is a real product name, using proper capitalization seems only
fair and intuitive.

Quote:
I am looking for feedback, and perhaps a volunteer to help make this a
proper CPAN module.
I might be able to help with that.

Quote:
The befifit of this module is never writing another connection string, and
not worrying about where to put your password.
Hey, that was one of the goals behind DBIx:WIW too. :-)

Jeremy
--
Jeremy D. Zawodny, <jzawodn (AT) yahoo-inc (DOT) com>
Technical Yahoo - Yahoo MySQL Geek
Desk: (408) 349-7878 Cell: (408) 685-5936

--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=ms...ie.nctu.edu.tw



Reply With Quote
  #5  
Old   
Dan Bolser
 
Posts: n/a

Default Re: Mysql::Simple - 09-18-2004 , 05:44 AM



On Fri, 17 Sep 2004, Jeremy Zawodny wrote:

Quote:
On Fri, Sep 17, 2004 at 06:17:24PM +0100, Dan Bolser wrote:

I have made a perl module called Mysql::Simple which parses /etc/my.cfg
and ~.my.cfg to set up Mysql connection parameters. In case it dosn't find
a password it uses Term::ReadPassword to get the user to supply one.

Can I suggest a naming change? MySQL::Simple instead of Mysql? Since
MySQL is a real product name, using proper capitalization seems only
fair and intuitive.
Great, MySQL::Simple it is.

Quote:
I am looking for feedback, and perhaps a volunteer to help make this a
proper CPAN module.

I might be able to help with that.
Naturally I wan't to help as much as I can, but I have no experience
packaging up a module for CPAN, and I guess this is relativly easy for
someone who knows what they are doing.

Quote:
The befifit of this module is never writing another connection string, and
not worrying about where to put your password.

Hey, that was one of the goals behind DBIx:WIW too. :-)
I like the module. It looks good. I wouldn't want to try to reimplement
any of the nice features supported by your module in MySQL::Simple, as it
looks like you have done a good job on those important features. Also I
guess I should look at DBIx::Password to see if it more sensible than
calls to Term::ReadPassword.

However, I gues you can tell from the name, a big aim of MySQL::Simple is
that it it as simple as possible, doing the minimum amount of
functionality, and mimicking a true mysql application as much as possible
(by reading command line args).

So I guess there is still room for MySQL simple?

How should we/I procede? I can put the code somewhere, or I can read a
'cpan packaging module begginers guide / how-to / cookbook' and we can go
from there.

Quote:
Jeremy

Thanks very much for your support,
Dan.


--
MySQL Perl Mailing List
For list archives: http://lists.mysql.com/perl
To unsubscribe: http://lists.mysql.com/perl?unsub=ms...ie.nctu.edu.tw



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.