From ce92ba767a9557daf7f18be94882dd7e6f4591fb Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Thu, 30 Sep 2010 09:24:33 -0400
Subject: [PATCH] - Plugin API: improved 'abort' flag handling, added 'result' item in some hooks: group_*, contact_*, identity_* (#1486914)
---
program/lib/MDB2/Driver/Function/sqlite.php | 47 ++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 42 insertions(+), 5 deletions(-)
diff --git a/program/lib/MDB2/Driver/Function/sqlite.php b/program/lib/MDB2/Driver/Function/sqlite.php
index 3a4960b..34e4fcb 100644
--- a/program/lib/MDB2/Driver/Function/sqlite.php
+++ b/program/lib/MDB2/Driver/Function/sqlite.php
@@ -2,7 +2,7 @@
// +----------------------------------------------------------------------+
// | PHP versions 4 and 5 |
// +----------------------------------------------------------------------+
-// | Copyright (c) 1998-2006 Manuel Lemos, Tomas V.V.Cox, |
+// | Copyright (c) 1998-2008 Manuel Lemos, Tomas V.V.Cox, |
// | Stig. S. Bakken, Lukas Smith |
// | All rights reserved. |
// +----------------------------------------------------------------------+
@@ -42,7 +42,7 @@
// | Author: Lukas Smith <smith@pooteeweet.org> |
// +----------------------------------------------------------------------+
//
-// $Id: sqlite.php,v 1.8 2006/06/13 22:55:55 lsmith Exp $
+// $Id: sqlite.php 295587 2010-02-28 17:16:38Z quipo $
//
require_once 'MDB2/Driver/Function/Common.php';
@@ -90,6 +90,22 @@
}
// }}}
+ // {{{ unixtimestamp()
+
+ /**
+ * return string to call a function to get the unix timestamp from a iso timestamp
+ *
+ * @param string $expression
+ *
+ * @return string to call a variable with the timestamp
+ * @access public
+ */
+ function unixtimestamp($expression)
+ {
+ return 'strftime("%s",'. $expression.', "utc")';
+ }
+
+ // }}}
// {{{ substring()
/**
@@ -100,10 +116,10 @@
*/
function substring($value, $position = 1, $length = null)
{
- if (!is_null($length)) {
- return "substr($value,$position,$length)";
+ if (null !== $length) {
+ return "substr($value, $position, $length)";
}
- return "substr($value,$position,length($value))";
+ return "substr($value, $position, length($value))";
}
// }}}
@@ -121,5 +137,26 @@
}
// }}}
+ // {{{ replace()
+
+ /**
+ * return string to call a function to get a replacement inside an SQL statement.
+ *
+ * @return string to call a function to get a replace
+ * @access public
+ */
+ function replace($str, $from_str, $to_str)
+ {
+ $db = $this->getDBInstance();
+ if (PEAR::isError($db)) {
+ return $db;
+ }
+
+ $error = $db->raiseError(MDB2_ERROR_UNSUPPORTED, null, null,
+ 'method not implemented', __FUNCTION__);
+ return $error;
+ }
+
+ // }}}
}
?>
--
Gitblit v1.9.1