Query length

Chris Jack (msn) chris_jack at msn.com
Tue Mar 18 07:57:07 GMT 2008


> Please let me know if there is any particular length of query perl
> supports.


Depends on the database and the type. If you're talking text fields in
Sybase, there is a default maximum length that you can overwrite for
instance.


> for ($x = 1; $x <= $num_inserts; $x++)
>             {
>                print "insert_string_$x = $insert_string[$x] \n" if $debug;
>                $db->sql($insert_string[$x]);
>                $db->sql("commit");
>            }
>
> Is there any way I can do it at one go instead of making so many small
> small queries.


You might like to commit every n statements to reduce logging overhead (as
you've only got 10 - you may as well do them all).

Again, if you're using a database like Sybase, you can execute them all in
one statement. Better still, you could use a stored procedure and save on
compile overhead.

What you really want, though, is to buy this:
http://www.amazon.co.uk/Programming-Perl-DBI-Database/dp/1565926994/ref=pd_b
bs_sr_1?ie=UTF8&s=books&qid=1205827256&sr=8-1



More information about the london.pm mailing list