in reply to Re^2: Debian DBD::ODBC select row by timestamp
in thread Debian DBD::ODBC select row by timestamp
? is the placeholder. It serves great use and it protects you against SQL injection attacks, by automatically quoting (and thereby neutralising) any "dangerous" characters.my $sth = $dbh-> prepare (SELECT val from table where DD_MM_YYYY = ?); $sth->execute('2012-07-22 00:00:00');
Of course you should add the usual or die ... checks to make sure no error happened. Also you have to verify the format of the DD_MM_YYY field to make sure your query sends in the timestamp in the right format.
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
My blog: Imperial Deltronics
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Debian DBD::ODBC select row by timestamp
by alexx_sh (Novice) on Jul 24, 2012 at 05:38 UTC | |
by mje (Curate) on Jul 24, 2012 at 08:02 UTC | |
by alexx_sh (Novice) on Jul 24, 2012 at 09:18 UTC | |
by mje (Curate) on Jul 24, 2012 at 12:13 UTC | |
by alexx_sh (Novice) on Jul 24, 2012 at 12:20 UTC | |
|