Specifying a db function in an insert statement in Zend
I have something like this:
$data = array('use开发者_开发技巧rname' => 'John', 'password' => 'john123');
$table = new Zend_Db_Table('users');
$table->insert($data);
But I want it to include a hashing function to the password, so the sql is something like this:
INSERT INTO `users` (`username`, `password`) VALUES ('John', PASSWORD('john123'));
How can I do that, elegantly?
$data = array('username' => 'John', 'password' => new Zend_Db_Expr('SHA1(john123)');
精彩评论