in reply to Inserting large chunks of data into MySQL

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re: please how can i split string that is over 5MB
by moritz (Cardinal) on May 04, 2008 at 18:10 UTC
    It's useless to try to guess what the error might be, when at the same time an error message can be found in your server's error.log. If you don't have access to the log file, use this line at the top of your CGI script, it might help to get a better error message:
    use CGI::Carp qw(fatalsToBrowser);

    I also recommend to run the code on your own machine first and test it there.

Re: please how can i split string that is over 5MB
by CountZero (Bishop) on May 04, 2008 at 19:41 UTC
    More information about this error may be available in the server error log.

    Pray, tell us what was in the error log?

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Re: please how can i split string that is over 5MB
by pc88mxer (Vicar) on May 04, 2008 at 20:16 UTC
    I take it that the error that you are getting coming from your web server that your perl script is running on as a CGI. If so, look at the server's error log to see what error message perl itself generated.

    How are you reading $txtque (the one outside of the for loop) into memory in the first place? If it it coming from a file, you might try this:

    open my $fh, '<', '/the/file/with/txtque' or die "unable to open ...: $!\n"; { local($/) = '~'; while (my $txtque = <$fh>) { my $count = $dbh->do(...); # execute the INSERT statement here } }
    That is, read in one $txtque value at a time and execute the INSERT statement instead of reading in all of the $txtque values in before doing the inserts.
      using memory