cvs: pear /Log package.php package.xml /Log/Log sql.php /Log/docs guide.txt
| From: | Jon Parise | Date: | Mon, 24 Oct 2005 05:21:02 +0000 |
| Subject: | cvs: pear /Log package.php package.xml /Log/Log sql.php /Log/docs guide.txt | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-35810@lists.php.net to get a copy of this message | ||
jon Mon Oct 24 01:21:02 2005 EDT
Modified files:
/pear/Log package.php package.xml
/pear/Log/Log sql.php
/pear/Log/docs guide.txt
Log:
The SQL handler now supports user-provided SQL insertion statements via
the 'sql' configuration parameter.
Request: 5703
http://cvs.php.net/diff.php/pear/Log/package.php?r1=1.38&r2=1.39&ty=u
Index: pear/Log/package.php
diff -u pear/Log/package.php:1.38 pear/Log/package.php:1.39
--- pear/Log/package.php:1.38 Mon Oct 24 01:02:32 2005
+++ pear/Log/package.php Mon Oct 24 01:21:02 2005
@@ -5,6 +5,7 @@
$version = '1.9.1';
$notes = <<<EOT
The SQL handler failed to prepare the SQL statement when an existing database connection was
provided. (Bug 5702)
+The SQL handler now supports user-provided SQL insertion statements via the 'sql'
configuration parameter. (Request 5703)
EOT;
$changelog = $notes;
http://cvs.php.net/diff.php/pear/Log/package.xml?r1=1.95&r2=1.96&ty=u
Index: pear/Log/package.xml
diff -u pear/Log/package.xml:1.95 pear/Log/package.xml:1.96
--- pear/Log/package.xml:1.95 Mon Oct 24 01:02:32 2005
+++ pear/Log/package.xml Mon Oct 24 01:21:02 2005
@@ -19,6 +19,7 @@
<license>PHP License</license>
<state>stable</state>
<notes>The SQL handler failed to prepare the SQL statement when an existing database
connection was provided. (Bug 5702)
+The SQL handler now supports user-provided SQL insertion statements via the 'sql'
configuration parameter. (Request 5703)
</notes>
<deps>
<dep type="pkg" rel="ge" version="1.3"
optional="yes">DB</dep>
@@ -92,6 +93,7 @@
<license>PHP License</license>
<state>stable</state>
<notes>The SQL handler failed to prepare the SQL statement when an existing database
connection was provided. (Bug 5702)
+The SQL handler now supports user-provided SQL insertion statements via the 'sql'
configuration parameter. (Request 5703)
</notes>
</release>
<release>
http://cvs.php.net/diff.php/pear/Log/Log/sql.php?r1=1.37&r2=1.38&ty=u
Index: pear/Log/Log/sql.php
diff -u pear/Log/Log/sql.php:1.37 pear/Log/Log/sql.php:1.38
--- pear/Log/Log/sql.php:1.37 Mon Oct 24 01:02:33 2005
+++ pear/Log/Log/sql.php Mon Oct 24 01:21:02 2005
@@ -1,9 +1,9 @@
<?php
/**
- * $Header: /repository/pear/Log/Log/sql.php,v 1.37 2005/10/24 05:02:33 jon Exp $
+ * $Header: /repository/pear/Log/Log/sql.php,v 1.38 2005/10/24 05:21:02 jon Exp $
* $Horde: horde/lib/Log/sql.php,v 1.12 2000/08/16 20:27:34 chuck Exp $
*
- * @version $Revision: 1.37 $
+ * @version $Revision: 1.38 $
* @package Log
*/
@@ -43,6 +43,14 @@
var $_dsn = '';
/**
+ * String containing the SQL insertion statement.
+ *
+ * @var string
+ * @access private
+ */
+ var $_sql = '';
+
+ /**
* Array containing our set of DB configuration options.
* @var array
* @access private
@@ -109,9 +117,17 @@
$this->_table = $name;
$this->_mask = Log::UPTO($level);
+ /* Now that we have a table name, assign our SQL statement. */
+ if (!empty($this->_sql)) {
+ $this->_sql = $conf['sql'];
+ } else {
+ $this->_sql('INSERT INTO ' . $this->_table .
+ ' (id, logtime, ident, priority, message)' .
+ ' VALUES(?, CURRENT_TIMESTAMP, ?, ?, ?)');
+ }
+
/* If an options array was provided, use it. */
- if (isset($conf['options']) && is_array($conf['options']))
- {
+ if (isset($conf['options']) && is_array($conf['options'])) {
$this->_options = $conf['options'];
}
@@ -263,10 +279,7 @@
*/
function _prepareStatement()
{
- $this->_statement =
- $this->_db->prepare('INSERT INTO ' . $this->_table .
- ' (id, logtime, ident, priority, message)' .
- ' VALUES(?, CURRENT_TIMESTAMP, ?, ?, ?)');
+ $this->_statement = $this->_db->prepare($this->_sql);
/* Return success if we didn't generate an error. */
return (DB::isError($this->_statement) === false);
http://cvs.php.net/diff.php/pear/Log/docs/guide.txt?r1=1.22&r2=1.23&ty=u
Index: pear/Log/docs/guide.txt
diff -u pear/Log/docs/guide.txt:1.22 pear/Log/docs/guide.txt:1.23
--- pear/Log/docs/guide.txt:1.22 Tue Oct 11 01:37:26 2005
+++ pear/Log/docs/guide.txt Mon Oct 24 01:21:02 2005
@@ -8,8 +8,8 @@
:Author: Jon Parise
:Contact: jon@php.net
-:Date: $Date: 2005/10/11 05:37:26 $
-:Revision: $Revision: 1.22 $
+:Date: $Date: 2005/10/24 05:21:02 $
+:Revision: $Revision: 1.23 $
.. contents:: Contents
.. section-numbering::
@@ -595,6 +595,8 @@
| `
dsn | Mixed | '' (empty) | A
Data Source Name`_. |
| | | | |required| |
+-------------------+-----------+---------------+---------------------------+
+| `sql` | String | |sql-default| | SQL insertion statement. |
++-------------------+-----------+---------------+---------------------------+
| `options | Array | persistent| An array of
DB`_ options.|
+-------------------+-----------+---------------+---------------------------+
| `db | Object | NULL | An existing DB`_ object. |
@@ -620,6 +622,8 @@
specified using the `$name construction parameter (see Configuring a
Handler`_).
+.. |sql-default| replace:: `INSERT INTO $table (id, logtime, ident, priority, message)
VALUES(?, CURRENT_TIMESTAMP, ?, ?, ?)`
+
.. _DB: http://pear.php.net/package/DB
.. _PEAR's DB abstraction layer: DB_
.. _Data Source Name: http://pear.php.net/manual/en/package.database.db.intro-dsn.php