Update of /cvsroot/phpwiki/phpwiki/lib/WikiDB/backend
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30160/backend
Modified Files:
ADODB_postgres7.php
Log Message:
use BlobEncode and UpdateBlob
Index: ADODB_postgres7.php
===================================================================
RCS file: /cvsroot/phpwiki/phpwiki/lib/WikiDB/backend/ADODB_postgres7.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -2 -b -p -d -r1.2 -r1.3
--- ADODB_postgres7.php 10 Oct 2005 19:42:15 -0000 1.2
+++ ADODB_postgres7.php 31 Oct 2005 16:49:02 -0000 1.3
@@ -10,5 +10,7 @@ if (!defined("USE_BYTEA")) // see schema
/**
* WikiDB layer for ADODB-postgres (7 or 8), called by lib/WikiDB/ADODB.php.
- * Since 1.3.12 changed to use Foreign Keys and ON DELETE CASCADE
+ * Changes 1.3.12:
+ * - use Foreign Keys and ON DELETE CASCADE.
+ * - bytea blob type
*
* @author: Reini Urban
@@ -42,7 +44,8 @@ extends WikiDB_backend_ADODB
}
+ // just for blobs. the rest is escaped with qstr()
function _quote($s) {
if (USE_BYTEA)
- return pg_escape_bytea($s);
+ return $this->_dbh->BlobEncode($s);
if (function_exists('pg_escape_string'))
return pg_escape_string($s);
@@ -51,7 +54,12 @@ extends WikiDB_backend_ADODB
}
+ // just for blobs, which might be base64_encoded
function _unquote($s) {
- if (USE_BYTEA)
- return pg_unescape_bytea($s);
+ if (USE_BYTEA) {
+ //if function_exists('pg_unescape_bytea')
+ //return pg_unescape_bytea($s);
+ // TODO: already unescaped by ADORecordSet_postgres64::_decode?
+ return $s;
+ }
if (function_exists('pg_escape_string'))
return $s;
@@ -60,5 +68,4 @@ extends WikiDB_backend_ADODB
}
- // Until the binary escape problems on pear pgsql are solved */
function get_cached_html($pagename) {
$dbh = &$this->_dbh;
@@ -73,13 +80,15 @@ extends WikiDB_backend_ADODB
$dbh = &$this->_dbh;
$page_tbl = $this->_table_names['page_tbl'];
- // TODO: Maybe use UpdateBlob
- if (USE_BYTEA)
- $sth = $dbh->Execute(sprintf("UPDATE $page_tbl"
+ if (USE_BYTEA) {
+ $dbh->UpdateBlob($page_tbl,'cached_html',$data,"pagename=".$dbh->qstr($pagename));
+ /*
+ $dbh->Execute(sprintf("UPDATE $page_tbl"
. " SET cached_html='%s'"
. " WHERE pagename=%s",
$this->_quote($data),
$dbh->qstr($pagename)));
- else
- $sth = $dbh->Execute("UPDATE $page_tbl"
+ */
+ } else {
+ $dbh->Execute("UPDATE $page_tbl"
. " SET cached_html=?"
. " WHERE pagename=?",
|