|
CVS: phpwiki/lib/WikiDB/backend ADODB.php,1.70,1.71: msg#00139web.wiki.phpwiki.checkins
Update of /cvsroot/phpwiki/phpwiki/lib/WikiDB/backend In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6673/lib/WikiDB/backend Modified Files: ADODB.php Log Message: fix listOfFields with different database Index: ADODB.php =================================================================== RCS file: /cvsroot/phpwiki/phpwiki/lib/WikiDB/backend/ADODB.php,v retrieving revision 1.70 retrieving revision 1.71 diff -u -2 -b -p -d -r1.70 -r1.71 --- ADODB.php 18 Jan 2005 20:55:43 -0000 1.70 +++ ADODB.php 25 Jan 2005 08:01:00 -0000 1.71 @@ -76,4 +76,5 @@ extends WikiDB_backend $parsed = parseDSN($dbparams['dsn']); $this->_dbparams = $dbparams; + $this->_parsedDSN =& $parsed; $this->_dbh = &ADONewConnection($parsed['phptype']); if (DEBUG & _DEBUG_SQL) { @@ -82,5 +83,7 @@ extends WikiDB_backend } $this->_dsn = $parsed; - if (!empty($parsed['persistent'])) + // persistent is defined as DSN option, or with a config value. + // phptype://username:password@hostspec/database?persistent=false + if (!empty($parsed['persistent']) or DATABASE_PERSISTENT) $conn = $this->_dbh->PConnect($parsed['hostspec'],$parsed['username'], $parsed['password'], $parsed['database']); @@ -1117,9 +1120,25 @@ extends WikiDB_backend return $this->_dbh->MetaTables(); } - function listOfFields($database,$table) { + + // other database needs another connection and other privileges. + function listOfFields($database, $table) { $field_list = array(); - foreach ($this->_dbh->MetaColumns($table,false) as $field) { + $old_db = $this->database(); + if ($database != $old_db) { + $conn = $this->_dbh->Connect($this->_parsedDSN['hostspec'], + DBADMIN_USER ? DBADMIN_USER : $this->_parsedDSN['username'], + DBADMIN_PASSWD ? DBADMIN_PASSWD : $this->_parsedDSN['password'], + $database); + } + foreach ($this->_dbh->MetaColumns($table, false) as $field) { $field_list[] = $field->name; } + if ($database != $old_db) { + $this->_dbh->close(); + $conn = $this->_dbh->Connect($this->_parsedDSN['hostspec'], + $this->_parsedDSN['username'], + $this->_parsedDSN['password'], + $old_db); + } return $field_list; } @@ -1395,4 +1414,7 @@ extends WikiDB_backend_search // $Log$ +// Revision 1.71 2005/01/25 08:01:00 rurban +// fix listOfFields with different database +// // Revision 1.70 2005/01/18 20:55:43 rurban // reformatting and two bug fixes: adding missing parens ------------------------------------------------------- This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting Tool for open source databases. Create drag-&-drop reports. Save time by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc. Download a FREE copy at http://www.intelliview.com/go/osdn_nl |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | CVS: phpwiki/pgsrc RandomPage,1.4,1.5: 00139, Reini Urban |
|---|---|
| Next by Date: | CVS: phpwiki/lib/WikiDB/backend PearDB.php,1.84,1.85: 00139, Reini Urban |
| Previous by Thread: | CVS: phpwiki/pgsrc RandomPage,1.4,1.5i: 00139, Reini Urban |
| Next by Thread: | CVS: phpwiki/lib/WikiDB/backend PearDB.php,1.84,1.85: 00139, Reini Urban |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |