Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^4: Debian DBD::ODBC select row by timestamp

by alexx_sh (Novice)
on Jul 24, 2012 at 05:38 UTC ( #983300=note: print w/ replies, xml ) Need Help??


in reply to Re^3: Debian DBD::ODBC select row by timestamp
in thread Debian DBD::ODBC select row by timestamp

when i try your code i get err

Search pattern not terminated at ./script.pl line 34.

if i try code like this $dbh-> prepare ('SELECT val from table where DD_MM_YYYY = ?');

Error at Line : syntax error near ?


Comment on Re^4: Debian DBD::ODBC select row by timestamp
Download Code
Re^5: Debian DBD::ODBC select row by timestamp
by mje (Deacon) on Jul 24, 2012 at 08:02 UTC

    Can we see the script and the actual error messsage for the second case (including line number). The first case just needed quotes adding.

      Yes.
      use strict; use warnings; use DBI; use Data::Dumper; use JSON::XS; my $dbh = DBI->connect (q{DBI:ODBC:test}) or die $DBI::errstr; my $sth = $dbh-> prepare("SELECT val from buf WHERE dd_mm_yyyy= ? ") o +r die $dbh->errstr(); $sth->execute('2012-07-22 00:00:00') or die $dbh->errstr(); my $table; my $tbl_ary_ref; $tbl_ary_ref = $sth->fetchall_arrayref; if (defined $tbl_ary_ref){ $table->{date} = $tbl_ary_ref; } $tbl_ary_ref = encode_json $table; print qq{JSON-------------------JSON\n}; print $tbl_ary_ref."\n"; $sth->finish; $dbh->disconnect;
      And output:
      Error at Line : syntax error near ? JSON-------------------JSON {"date":[]}

        That Perl looks syntactically correct to me so I assume the message comes from MS Access and yet if that were the case your script would have died at line 11 or 12. The output with the JSON seems to confirm that. Are you sure that is the script you are running?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://983300]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (12)
As of 2014-08-22 16:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (160 votes), past polls