Perl dbi insert freezes up

N

nmoinvaziri

I have a perl dbi script that is freezing up when you insert too much
text.

The code I have is something like this..

$sth = $dbh->prepare("INSERT INTO tb_news VALUES (?,?,?,?,?,?)")
or &msg("Error", "Cannot prepare statement: " . $dbh->errstr);

local $date = param('year') . "-" . param('month') . "-" .
param('day');
local $title = param('title');
local $description = param('description');

$sth->execute($count, $date, $title, $description, $image_url, 'N')
or &msg("Error", "Cannot execute statement: ". $sth->errstr);

The description field is a MySQL text column. On the form, if I enter
in anything that exceeds 1159 or around 1160 characters, the post query
freezes up.

Is this a server setting perhaps?

Nathan
 
M

Matt Garrish

I have a perl dbi script that is freezing up when you insert too much
text.

The code I have is something like this..

$sth = $dbh->prepare("INSERT INTO tb_news VALUES (?,?,?,?,?,?)")
or &msg("Error", "Cannot prepare statement: " . $dbh->errstr);

Why are you prefacing the msg subroutine call with '&'? I really doubt you
want to pass the current @_.
local $date = param('year') . "-" . param('month') . "-" .
param('day');
local $title = param('title');
local $description = param('description');

$sth->execute($count, $date, $title, $description, $image_url, 'N')
or &msg("Error", "Cannot execute statement: ". $sth->errstr);

The description field is a MySQL text column. On the form, if I enter
in anything that exceeds 1159 or around 1160 characters, the post query
freezes up.

I doubt it has anything to do with MySQL or the DBI module and everything to
do with a max upload limit on your server. You can run into issues
retrieving data depending on how LongReadLen and LongTruncOk are set, but
I've never run into or heard of a limit on data being inserted.

Matt
 
N

nmoinvaziri

Do you know the name of the max upload limit setting for Perl and where
it is located?
 
K

Keith Keller

Do you know the name of the max upload limit setting for Perl and where
it is located?

Please quote proper context.

For the CGI module, read the docs. Look for POST_MAX.

For your web server, read the docs for your webserver.

--keith
 
A

Anno Siegel

Matt Garrish said:
Why are you prefacing the msg subroutine call with '&'? I really doubt you
want to pass the current @_.

That's not what & does here, not with an explicit parameter list.

It is unnecessary, and it circumvents a prototype msg() might have,
but the parameters are passed as usual.

Anno
 
M

Matt Garrish

Anno Siegel said:
That's not what & does here, not with an explicit parameter list.

It is unnecessary, and it circumvents a prototype msg() might have,
but the parameters are passed as usual.

You're right, of course. I'm going to do everyone a favour and not post for
a while. It appears learning jsp and trying to still post here is turning my
brain to mush, so I'll spare you having to correct these dumb oversights
I've been prone to lately...

Matt
 
X

xhoster

I have a perl dbi script that is freezing up when you insert too much
text.

The code I have is something like this..

$sth = $dbh->prepare("INSERT INTO tb_news VALUES (?,?,?,?,?,?)")
or &msg("Error", "Cannot prepare statement: " . $dbh->errstr);

local $date = param('year') . "-" . param('month') . "-" .
param('day');
local $title = param('title');
local $description = param('description');

Why the locals?
$sth->execute($count, $date, $title, $description, $image_url, 'N')
or &msg("Error", "Cannot execute statement: ". $sth->errstr);

The description field is a MySQL text column. On the form, if I enter
in anything that exceeds 1159 or around 1160 characters, the post query
freezes up.

I doubt that it "freezes up". It is probably generating an error, and
sending it somewhere. Figure out where, then look at the error.
Is this a server setting perhaps?

Probably. But which server, the perl server or the database server?

Xho
 
N

nmoinvaziri

This is legacy perl code that I am taking over for the moment.
I tried inserting the following into the perl code, but it makes no
difference.

$CGI::pOST_MAX=1024 * 100; # max 100K posts

Whenever the perl script sees I have such and such amount of post data,
it just
hangs.

I also tried removing the & from before the msg but it didn't help. I
am using use CGI::Carp qw(fatalsToBrowser); and it didn't doesn't
return anything cause the page just hangs.
 
J

J. Gleixner

This is legacy perl code that I am taking over for the moment.
I tried inserting the following into the perl code, but it makes no
difference.

$CGI::pOST_MAX=1024 * 100; # max 100K posts

Whenever the perl script sees I have such and such amount of post data,
it just
hangs.

I also tried removing the & from before the msg but it didn't help. I
am using use CGI::Carp qw(fatalsToBrowser); and it didn't doesn't
return anything cause the page just hangs.

Sooner or later something should time out.

You need to determine if it's the CGI interaction or the DB.
Start by eliminating the CGI related code and just deal with
inserting the same information into the DB.

Check your error logs for the DB and the processes on your DB,
s the process is running. Be sure to enable logging for your DB.

If it is the DB, then eliminate the CGI and perl from the picture,
put together a test and discuss it in a newsgroup for that DB. If
it's MySQL, possibly it's exceeding the max_allowed_packet
setting? That's not too likely, but I've seen it mentioned before.
 
J

J. Gleixner

J. Gleixner said:
Check your error logs for the DB and the processes on your DB,
s the process is running. Be sure to enable logging for your DB.

Missed an 'a' there.

as the process is running.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top