in reply to Re^5: Debian DBD::ODBC select row by timestamp
in thread Debian DBD::ODBC select row by timestamp
And output: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;
Error at Line : syntax error near ? JSON-------------------JSON {"date":[]}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: Debian DBD::ODBC select row by timestamp
by mje (Curate) on Jul 24, 2012 at 12:13 UTC | |
by alexx_sh (Novice) on Jul 24, 2012 at 12:20 UTC | |
by mje (Curate) on Jul 24, 2012 at 14:14 UTC |