MySQL Forums
Forum List  »  Perl

how to bind_param SQL now() in prepared statement
Posted by: Markus Krebs
Date: July 20, 2007 03:29AM

Hi all,

i have a question regarding the use of the SQL function now() with prepared Statements via DBD::mysql:

i use to prepare queries this way:

$STH=$DBH->prepare("update table set a=?,b=?,c=? where id=?");

and bind the values:

$STH->bind_param(1,$value1,{TYPE=>SQL_INT});
...

and so on.

Now here is what i want to do:

Suppose "a" is a datetime column.
How can i bind the parameter "now()" to this column in a prepared statement, so the scalar "now()" wont get quoted by DBI?
Which SQL_TYPE should i use with DBI::bind_param()?

Sometimes the value is a datetime string (SQL_CHAR), sometimes it will be the current datetime (SQL now()).

Can someone give me a hint on this problem, please?

Regards,
makro

Options: ReplyQuote


Subject
Written By
Posted
how to bind_param SQL now() in prepared statement
July 20, 2007 03:29AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.