cvs: pear /MDB2/MDB2/Driver/Function sqlite.php
| From: | Lukas Smith | Date: | Mon, 17 Oct 2005 08:06:46 +0000 |
| Subject: | cvs: pear /MDB2/MDB2/Driver/Function sqlite.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-35633@lists.php.net to get a copy of this message | ||
lsmith Mon Oct 17 04:06:46 2005 EDT
Modified files:
/pear/MDB2/MDB2/Driver/Function sqlite.php
Log:
- allow selection of timestamp, date or time in now()
http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/Function/sqlite.php?r1=1.2&r2=1.3&ty=u
Index: pear/MDB2/MDB2/Driver/Function/sqlite.php
diff -u pear/MDB2/MDB2/Driver/Function/sqlite.php:1.2 pear/MDB2/MDB2/Driver/Function/sqlite.php:1.3
--- pear/MDB2/MDB2/Driver/Function/sqlite.php:1.2 Sun Oct 16 05:44:47 2005
+++ pear/MDB2/MDB2/Driver/Function/sqlite.php Mon Oct 17 04:06:46 2005
@@ -42,7 +42,7 @@
// | Author: Lukas Smith <smith@pooteeweet.org> |
// +----------------------------------------------------------------------+
//
-// $Id: sqlite.php,v 1.2 2005/10/16 09:44:47 lsmith Exp $
+// $Id: sqlite.php,v 1.3 2005/10/17 08:06:46 lsmith Exp $
//
require_once 'MDB2/Driver/Function/Common.php';
@@ -70,14 +70,23 @@
// {{{ now()
/**
- * return string to call a function to get the current timestamp inside an SQL statement
+ * Return string to call a variable with the current timestamp inside an SQL statement
+ * There are three special variables for current date and time.
*
- * @return string to call a function to get the current timestamp
+ * @return string to call a variable with the current timestamp
* @access public
- **/
- function now()
+ */
+ function now($type = 'timestamp')
{
- return "datetime()";
+ switch ($type) {
+ case 'time':
+ return 'time()';
+ case 'date':
+ return 'date()';
+ case 'timestamp':
+ default:
+ return 'datetime()';
+ }
}
}
?>