Re: do() with bind_values

2004-05-14 Thread JupiterHost.Net
I'm actually looking for the source code for execute() (IE sub execute { .. }), do() and quote() are in DBI.pm, prepare() is in DBD/mysql.pm but execute in neither. The source code for execute is in dbd_st_execute() in dbdimp.c, and if you want to know how the quoting is done, you will need to

Re: do() with bind_values

2004-05-14 Thread Rudy Lippan
On Wed, 12 May 2004, JupiterHost.Net wrote: > Ronald J Kimball wrote: > > > > JupiterHost.Net [mailto:[EMAIL PROTECTED] wrote: > > > > > >>I found do() and quote() in DBI.pm, prepare() in DBD::mysql, but I > >>couldn't find execute() - I wanted to see how it does the quoting > >>exactly (for bi

Re: do() with bind_values

2004-05-12 Thread JupiterHost.Net
Ronald J Kimball wrote: JupiterHost.Net [mailto:[EMAIL PROTECTED] wrote: I found do() and quote() in DBI.pm, prepare() in DBD::mysql, but I couldn't find execute() - I wanted to see how it does the quoting exactly (for binary data) - Anyone know where execute() is? All of these are covered in

RE: do() with bind_values

2004-05-12 Thread Ronald J Kimball
JupiterHost.Net [mailto:[EMAIL PROTECTED] wrote: > I found do() and quote() in DBI.pm, prepare() in DBD::mysql, but I > couldn't find execute() - I wanted to see how it does the quoting > exactly (for binary data) - > > Anyone know where execute() is? All of these are covered in the DBI docume

Re: do() with bind_values

2004-05-12 Thread JupiterHost.Net
Thanks guys! You don't need to call quote(). When you bind values to placeholders, the values are quote()d automatically. So: $dbh->do( 'INSERT INTO Stuff (Id,Foo,Bar,Baz) VALUES (NULL,?,?,?)', undef, $foo, $bar, $baz ) or die is the same (IE does the same things

Re: do() with bind_values

2004-05-12 Thread Scott T. Hildreth
On Wed, 2004-05-12 at 10:48, JupiterHost.Net wrote: > Thanks for all the replies! Its much clearer now :) > > Just to clear up the qw() issue, I included quotes so that the data > would be quote()ed for the query, not sure if that was necessary or not > since do() didn't do quote()... > > IE I

RE: do() with bind_values

2004-05-12 Thread Ronald J Kimball
JupiterHost.Net [mailto:[EMAIL PROTECTED] wrote: > Just to clear up the qw() issue, I included quotes so that the data > would be quote()ed for the query, not sure if that was necessary or not > since do() didn't do quote()... > > IE I was passing "'data'" (single quotes as part of the string)

RE: do() with bind_values

2004-05-12 Thread Ronald Kimball
JupiterHost.Net [mailto:[EMAIL PROTECTED] wrote: > perldoc DBI > has this: > $rv = $dbh->do($statement, \%attr, @bind_values); > > So would this be a proper use of it: > > $dbh->do( > 'INSERT INTO Stuff (Id,Foo) VALUES (NULL,?)', > undef, > qw('foo' 'bar' 'baz') > ) or die

Re: do() with bind_values

2004-05-12 Thread Scott T. Hildreth
no, the @bind_values is a list to bound for that statement. It could 1 or many (i.e. if you have where id = ? and date = ? ). If you have a list of values that need to be inserted into different rows, then iterate through the array and execute the 'do'. A word of caution, if the list is going to

Re: do() with bind_values

2004-05-12 Thread JupiterHost.Net
Thanks for all the replies! Its much clearer now :) Just to clear up the qw() issue, I included quotes so that the data would be quote()ed for the query, not sure if that was necessary or not since do() didn't do quote()... IE I was passing "'data'" (single quotes as part of the string) and no

do() with bind_values

2004-05-12 Thread JupiterHost.Net
Howdy group! perldoc DBI has this: $rv = $dbh->do($statement, \%attr, @bind_values); So would this be a proper use of it: $dbh->do( 'INSERT INTO Stuff (Id,Foo) VALUES (NULL,?)', undef, qw('foo' 'bar' 'baz') ) or die # IE undef foro \%attr and include quoted data That would e