This code worked under perl4 but when i upgraded the server it gives me this error DBD::mysql::st execute failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 at /www/cgi-bin/recordsets/BaseRecordset.pm line 66. Any help will be apreciated.
1 package BaseRecordset; 2 use Carp; 3 4 use lib '/www/cgi-bin/libraries'; 5 use Library; 6 7 sub _initialize { 8 my $self = shift; 9 $self->{'m_dbhConnection'} = $self->DefaultConnection( + ); 10 $self->{'m_strFilter'} = ""; 11 $self->{'m_strSort'} = ""; 12 $self->{'m_strGroup'} = ""; 13 $self->{'m_dbhHandle'} = ""; 14 $self->{'m_lRows'} = "0"; 15 $self->{'m_lPos'} = "0"; 16 $self->{'m_bEdit'} = ""; 17 $self->{'m_lCurrentId'} = "0"; 18 } 19 20 sub DefaultConnection { 21 my $self = shift; 22 23 my $pLibrary = new Library; 24 my $dbh = $pLibrary->GetDB(); 25 26 return $dbh; 27 } 28 29 sub Query { 30 my $self = shift; 31 my $lpszQuery = "select * from " . $self->GetDefaultQu +ery(); 32 33 if ( $self->m_strFilter ne "" ) { 34 $lpszQuery .= " where " . $self->m_strFilter; 35 } else { 36 $lpszQuery .= " where id < '0'"; 37 } 38 39 if ( $self->m_strSort ne "" ) { 40 $lpszQuery .= " order by " . $self->m_strSort; 41 } 42 43 if ( $self->m_strGroup ne "" ) { 44 $lpszQuery .= " group by " . $self->m_strGroup +; 45 } 46 47 return $lpszQuery; 48 } 49 50 sub Open { 51 my $self = shift; 52 53 $self->Execute( $self->Query( ) , "True" ); 54 $self->m_lPos( 0 ); 55 $self->m_lRows( $self->m_dbhHandle->rows ); 56 $self->DoDataExchange( ); 57 } 58 59 sub Execute { 60 my $self = shift; 61 my ( $lpszQuery , $bIsSelect ) = @_; 62 my $dbhAlterHandle; 63 64 if ( $bIsSelect eq "True" ) { 65 $self->m_dbhHandle( $self->m_dbhConnection->pr +epare( $lpszQuery ) ); 66 $self->m_dbhHandle->execute; 69 } else { 70 $dbhAlterHandle = $self->m_dbhConnection->prep +are( $lpszQuery ); 71 $dbhAlterHandle->execute; 72 $dbhAlterHandle->finish; 73 } 74 75 } 76
67, 68 omitted, they are comments Thanks

In reply to DBD::mysql::st execute failed by jmccall

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.