cvs: pear /MDB2 MDB2.php /MDB2/MDB2 Extended.php LOB.php /MDB2/MDB2/Driver ibase.php mssql.php mysql.php oci8.php pgsql.php querysim.php sqlite.php
| From: | Lukas Smith | Date: | Wed, 27 Oct 2004 16:55:29 +0000 |
| Subject: | cvs: pear /MDB2 MDB2.php /MDB2/MDB2 Extended.php LOB.php /MDB2/MDB2/Driver ibase.php mssql.php mysql.php oci8.php pgsql.php querysim.php sqlite.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-25292@lists.php.net to get a copy of this message | ||
lsmith Wed Oct 27 12:55:29 2004 EDT
Modified files:
/pear/MDB2 MDB2.php
/pear/MDB2/MDB2 Extended.php LOB.php
/pear/MDB2/MDB2/Driver ibase.php mssql.php mysql.php oci8.php
pgsql.php querysim.php sqlite.php
Log:
- cosmetic fixes
http://cvs.php.net/diff.php/pear/MDB2/MDB2.php?r1=1.51&r2=1.52&ty=u Index: pear/MDB2/MDB2.php diff -u pear/MDB2/MDB2.php:1.51 pear/MDB2/MDB2.php:1.52 --- pear/MDB2/MDB2.php:1.51 Sat Oct 23 12:11:14 2004 +++ pear/MDB2/MDB2.php Wed Oct 27 12:55:26 2004 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ // -// $Id: MDB2.php,v 1.51 2004/10/23 16:11:14 lsmith Exp $ +// $Id: MDB2.php,v 1.52 2004/10/27 16:55:26 lsmith Exp $ // /** @@ -1650,13 +1650,13 @@ $dsn['password'] = $hidepw; } switch ($type) { - // expand to include all possible options - case 'string': - $dsn = $dsn['phptype'].'://'.$dsn['username'].':'. - $dsn['password'].'@'.$dsn['hostspec']. - ($dsn['port'] ? (':'.$dsn['port']) : ''). - '/'.$dsn['database']; - break; + // expand to include all possible options + case 'string': + $dsn = $dsn['phptype'].'://'.$dsn['username'].':'. + $dsn['password'].'@'.$dsn['hostspec']. + ($dsn['port'] ? (':'.$dsn['port']) : ''). + '/'.$dsn['database']; + break; } return $dsn; } @@ -1923,10 +1923,9 @@ 'replace: replace query is not supported'); } $count = count($fields); - for ($keys = 0, $condition = $insert = $values = '', reset($fields), $colnum = 0; - $colnum < $count; - next($fields), $colnum++) - { + $condition = $insert = $values = ''; + $keys = $colnum = 0; + for (reset($fields); $colnum < $count; next($fields), $colnum++) { $name = key($fields); if ($colnum > 0) { $insert .= ', '; http://cvs.php.net/diff.php/pear/MDB2/MDB2/Extended.php?r1=1.11&r2=1.12&ty=u Index: pear/MDB2/MDB2/Extended.php diff -u pear/MDB2/MDB2/Extended.php:1.11 pear/MDB2/MDB2/Extended.php:1.12 --- pear/MDB2/MDB2/Extended.php:1.11 Fri Oct 22 16:43:04 2004 +++ pear/MDB2/MDB2/Extended.php Wed Oct 27 12:55:27 2004 @@ -42,7 +42,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ // -// $Id: Extended.php,v 1.11 2004/10/22 20:43:04 lsmith Exp $ +// $Id: Extended.php,v 1.12 2004/10/27 16:55:27 lsmith Exp $ /** * @package MDB2 @@ -163,39 +163,39 @@ } $first = true; switch ($mode) { - case MDB2_AUTOQUERY_INSERT: - $values = ''; - $names = ''; - while (list(, $value) = each($table_fields)) { - if ($first) { - $first = false; - } else { - $names .= ','; - $values .= ','; - } - $names .= $value; - $values .= '?'; + case MDB2_AUTOQUERY_INSERT: + $values = ''; + $names = ''; + while (list(, $value) = each($table_fields)) { + if ($first) { + $first = false; + } else { + $names .= ','; + $values .= ','; } - return "INSERT INTO $table ($names) VALUES ($values)"; - break; - case MDB2_AUTOQUERY_UPDATE: - $set = ''; - while (list(, $value) = each($table_fields)) { - if ($first) { - $first = false; - } else { - $set .= ','; - } - $set .= "$value = ?"; + $names .= $value; + $values .= '?'; + } + return "INSERT INTO $table ($names) VALUES ($values)"; + break; + case MDB2_AUTOQUERY_UPDATE: + $set = ''; + while (list(, $value) = each($table_fields)) { + if ($first) { + $first = false; + } else { + $set .= ','; } - $query = "UPDATE $table SET $set"; - if ($where) { - $query .= " WHERE $where"; - } - return $query; - break; - default: - $db->raiseError(MDB2_ERROR_SYNTAX); + $set .= "$value = ?"; + } + $query = "UPDATE $table SET $set"; + if ($where) { + $query .= " WHERE $where"; + } + return $query; + break; + default: + $db->raiseError(MDB2_ERROR_SYNTAX); } } http://cvs.php.net/diff.php/pear/MDB2/MDB2/LOB.php?r1=1.8&r2=1.9&ty=u Index: pear/MDB2/MDB2/LOB.php diff -u pear/MDB2/MDB2/LOB.php:1.8 pear/MDB2/MDB2/LOB.php:1.9 --- pear/MDB2/MDB2/LOB.php:1.8 Mon Oct 25 14:05:52 2004 +++ pear/MDB2/MDB2/LOB.php Wed Oct 27 12:55:27 2004 @@ -42,7 +42,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ // -// $Id: LOB.php,v 1.8 2004/10/25 18:05:52 lsmith Exp $ +// $Id: LOB.php,v 1.9 2004/10/27 16:55:27 lsmith Exp $ // @@ -170,9 +170,7 @@ 'MDB2_LOB_Input_File::create: it was specified an invalid input file identifier'); } $this->file = $arguments['file']; - } - else - { + } else { if (isset($arguments['file_name'])) { if ((!$this->file = fopen($arguments['file_name'], 'rb'))) { return MDB2_Driver_Common::raiseError(MDB2_ERROR_NOT_FOUND, null, null, @@ -287,8 +285,8 @@ for ($written = 0; !$this->db->datatype->endOfLOB($this->input_lob) && $written < $buffer_length; - $written += $read) - { + $written += $read + ) { $result = $this->db->datatype->readLOB($this->input_lob, $buffer, $buffer_length); if (MDB2::isError($result)) { return $result; http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/ibase.php?r1=1.44&r2=1.45&ty=u Index: pear/MDB2/MDB2/Driver/ibase.php diff -u pear/MDB2/MDB2/Driver/ibase.php:1.44 pear/MDB2/MDB2/Driver/ibase.php:1.45 --- pear/MDB2/MDB2/Driver/ibase.php:1.44 Tue Oct 26 06:16:26 2004 +++ pear/MDB2/MDB2/Driver/ibase.php Wed Oct 27 12:55:28 2004 @@ -43,7 +43,7 @@ // | Author: Lorenzo Alberton <l.alberton@quipo.it> | // +----------------------------------------------------------------------+ // -// $Id: ibase.php,v 1.44 2004/10/26 10:16:26 quipo Exp $ +// $Id: ibase.php,v 1.45 2004/10/27 16:55:28 lsmith Exp $ /** * MDB2 FireBird/InterBase driver @@ -136,48 +136,48 @@ // try to interpret Interbase error code (that's why we need ibase_errno() // in the interbase module to return the real error code) switch ($native_code) { - case -204: - if (isset($m[3]) && is_int(strpos($m[3], 'Table unknown'))) { - $errno = MDB2_ERROR_NOSUCHTABLE; - } + case -204: + if (isset($m[3]) && is_int(strpos($m[3], 'Table unknown'))) { + $errno = MDB2_ERROR_NOSUCHTABLE; + } + break; + default: + static $ecode_map; + if (empty($ecode_map)) { + $ecode_map = array( + -104 => MDB2_ERROR_SYNTAX, + -150 => MDB2_ERROR_ACCESS_VIOLATION, + -151 => MDB2_ERROR_ACCESS_VIOLATION, + -155 => MDB2_ERROR_NOSUCHTABLE, + 88 => MDB2_ERROR_NOSUCHTABLE, + -157 => MDB2_ERROR_NOSUCHFIELD, + -158 => MDB2_ERROR_VALUE_COUNT_ON_ROW, + -170 => MDB2_ERROR_MISMATCH, + -171 => MDB2_ERROR_MISMATCH, + -172 => MDB2_ERROR_INVALID, + -204 => MDB2_ERROR_INVALID, + -205 => MDB2_ERROR_NOSUCHFIELD, + -206 => MDB2_ERROR_NOSUCHFIELD, + -208 => MDB2_ERROR_INVALID, + -219 => MDB2_ERROR_NOSUCHTABLE, + -297 => MDB2_ERROR_CONSTRAINT, + -303 => MDB2_ERROR_INVALID, + -530 => MDB2_ERROR_CONSTRAINT, + -551 => MDB2_ERROR_ACCESS_VIOLATION, + -552 => MDB2_ERROR_ACCESS_VIOLATION, + -607 => MDB2_ERROR_NOSUCHTABLE, + -803 => MDB2_ERROR_CONSTRAINT, + -904 => MDB2_ERROR_CONNECT_FAILED, + -913 => MDB2_ERROR_DEADLOCK, + -922 => MDB2_ERROR_NOSUCHDB, + -923 => MDB2_ERROR_CONNECT_FAILED, + -924 => MDB2_ERROR_CONNECT_FAILED, + ); + } + if (isset($ecode_map[$native_code])) { + $error = $ecode_map[$native_code]; + } break; - default: - static $ecode_map; - if (empty($ecode_map)) { - $ecode_map = array( - -104 => MDB2_ERROR_SYNTAX, - -150 => MDB2_ERROR_ACCESS_VIOLATION, - -151 => MDB2_ERROR_ACCESS_VIOLATION, - -155 => MDB2_ERROR_NOSUCHTABLE, - 88 => MDB2_ERROR_NOSUCHTABLE, - -157 => MDB2_ERROR_NOSUCHFIELD, - -158 => MDB2_ERROR_VALUE_COUNT_ON_ROW, - -170 => MDB2_ERROR_MISMATCH, - -171 => MDB2_ERROR_MISMATCH, - -172 => MDB2_ERROR_INVALID, - -204 => MDB2_ERROR_INVALID, - -205 => MDB2_ERROR_NOSUCHFIELD, - -206 => MDB2_ERROR_NOSUCHFIELD, - -208 => MDB2_ERROR_INVALID, - -219 => MDB2_ERROR_NOSUCHTABLE, - -297 => MDB2_ERROR_CONSTRAINT, - -303 => MDB2_ERROR_INVALID, - -530 => MDB2_ERROR_CONSTRAINT, - -551 => MDB2_ERROR_ACCESS_VIOLATION, - -552 => MDB2_ERROR_ACCESS_VIOLATION, - -607 => MDB2_ERROR_NOSUCHTABLE, - -803 => MDB2_ERROR_CONSTRAINT, - -904 => MDB2_ERROR_CONNECT_FAILED, - -913 => MDB2_ERROR_DEADLOCK, - -922 => MDB2_ERROR_NOSUCHDB, - -923 => MDB2_ERROR_CONNECT_FAILED, - -924 => MDB2_ERROR_CONNECT_FAILED, - ); - } - if (isset($ecode_map[$native_code])) { - $error = $ecode_map[$native_code]; - } - break; } } else { static $error_regexps; @@ -444,8 +444,8 @@ $connection = ($this->auto_commit ? $this->connection : $this->transaction_id); if ($prepared_query && isset($this->query_parameters[$prepared_query]) - && count($this->query_parameters[$prepared_query]) > 2) - { + && count($this->query_parameters[$prepared_query]) > 2 + ) { $this->query_parameters[$prepared_query][0] = $connection; $this->query_parameters[$prepared_query][1] = $query; $result = @call_user_func_array('ibase_query', $this->query_parameters[$prepared_query]); http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/mssql.php?r1=1.33&r2=1.34&ty=u Index: pear/MDB2/MDB2/Driver/mssql.php diff -u pear/MDB2/MDB2/Driver/mssql.php:1.33 pear/MDB2/MDB2/Driver/mssql.php:1.34 --- pear/MDB2/MDB2/Driver/mssql.php:1.33 Fri Oct 22 17:30:20 2004 +++ pear/MDB2/MDB2/Driver/mssql.php Wed Oct 27 12:55:28 2004 @@ -43,7 +43,7 @@ // | Author: Frank M. Kromann <frank@kromann.info> | // +----------------------------------------------------------------------+ // -// $Id: mssql.php,v 1.33 2004/10/22 21:30:20 lsmith Exp $ +// $Id: mssql.php,v 1.34 2004/10/27 16:55:28 lsmith Exp $ // /** @@ -267,8 +267,8 @@ { if ($this->connection != 0) { if (count(array_diff($this->connected_dsn, $this->dsn)) == 0 - && $this->opened_persistent == $this->options['persistent']) - { + && $this->opened_persistent == $this->options['persistent'] + ) { return MDB2_OK; } $this->_close(); http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/mysql.php?r1=1.32&r2=1.33&ty=u Index: pear/MDB2/MDB2/Driver/mysql.php diff -u pear/MDB2/MDB2/Driver/mysql.php:1.32 pear/MDB2/MDB2/Driver/mysql.php:1.33 --- pear/MDB2/MDB2/Driver/mysql.php:1.32 Fri Oct 22 16:58:30 2004 +++ pear/MDB2/MDB2/Driver/mysql.php Wed Oct 27 12:55:28 2004 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ // -// $Id: mysql.php,v 1.32 2004/10/22 20:58:30 lsmith Exp $ +// $Id: mysql.php,v 1.33 2004/10/27 16:55:28 lsmith Exp $ // /** @@ -353,25 +353,25 @@ $default_table_type = $this->options['default_table_type']; if ($default_table_type) { switch ($this->options['default_table_type'] = strtoupper($default_table_type)) { - case 'BERKELEYDB': - $this->options['default_table_type'] = 'BDB'; - case 'BDB': - case 'INNODB': - case 'GEMINI': - break; - case 'HEAP': - case 'ISAM': - case 'MERGE': - case 'MRG_MYISAM': - case 'MYISAM': - if ($this->supports('transactions')) { - $this->warnings[] = $default_table_type. - ' is not a transaction-safe default table type'; - } - break; - default: + case 'BERKELEYDB': + $this->options['default_table_type'] = 'BDB'; + case 'BDB': + case 'INNODB': + case 'GEMINI': + break; + case 'HEAP': + case 'ISAM': + case 'MERGE': + case 'MRG_MYISAM': + case 'MYISAM': + if ($this->supports('transactions')) { $this->warnings[] = $default_table_type. - ' is not a supported default table type'; + ' is not a transaction-safe default table type'; + } + break; + default: + $this->warnings[] = $default_table_type. + ' is not a supported default table type'; } } @@ -589,10 +589,9 @@ function replace($table, $fields) { $count = count($fields); - for ($keys = 0, $query = $values = '',reset($fields), $colnum = 0; - $colnum < $count; - next($fields), $colnum++) - { + $query = $values = ''; + $keys = $colnum = 0; + for (reset($fields); $colnum < $count; next($fields), $colnum++) { $name = key($fields); if ($colnum > 0) { $query .= ','; http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/oci8.php?r1=1.30&r2=1.31&ty=u Index: pear/MDB2/MDB2/Driver/oci8.php diff -u pear/MDB2/MDB2/Driver/oci8.php:1.30 pear/MDB2/MDB2/Driver/oci8.php:1.31 --- pear/MDB2/MDB2/Driver/oci8.php:1.30 Sat Oct 23 12:06:23 2004 +++ pear/MDB2/MDB2/Driver/oci8.php Wed Oct 27 12:55:28 2004 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ -// $Id: oci8.php,v 1.30 2004/10/23 16:06:23 quipo Exp $ +// $Id: oci8.php,v 1.31 2004/10/27 16:55:28 lsmith Exp $ /** * MDB2 OCI8 driver @@ -296,8 +296,8 @@ } if ($this->connection != 0) { if (count(array_diff($this->connected_dsn, $this->dsn)) == 0 - && $this->opened_persistent == $this->options['persistent']) - { + && $this->opened_persistent == $this->options['persistent'] + ) { return MDB2_OK; } $this->_close(); http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/pgsql.php?r1=1.31&r2=1.32&ty=u Index: pear/MDB2/MDB2/Driver/pgsql.php diff -u pear/MDB2/MDB2/Driver/pgsql.php:1.31 pear/MDB2/MDB2/Driver/pgsql.php:1.32 --- pear/MDB2/MDB2/Driver/pgsql.php:1.31 Fri Oct 22 17:30:20 2004 +++ pear/MDB2/MDB2/Driver/pgsql.php Wed Oct 27 12:55:28 2004 @@ -43,7 +43,7 @@ // | Author: Paul Cooper <pgc@ucecom.com> | // +----------------------------------------------------------------------+ // -// $Id: pgsql.php,v 1.31 2004/10/22 21:30:20 lsmith Exp $ +// $Id: pgsql.php,v 1.32 2004/10/27 16:55:28 lsmith Exp $ /** * MDB2 PostGreSQL driver @@ -309,8 +309,8 @@ if ($this->connection != 0) { if (count(array_diff($this->connected_dsn, $this->dsn)) == 0 && !strcmp($this->connected_database_name, $this->database_name) - && ($this->opened_persistent == $this->options['persistent'])) - { + && ($this->opened_persistent == $this->options['persistent']) + ) { return MDB2_OK; } $this->_close(); http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/querysim.php?r1=1.20&r2=1.21&ty=u Index: pear/MDB2/MDB2/Driver/querysim.php diff -u pear/MDB2/MDB2/Driver/querysim.php:1.20 pear/MDB2/MDB2/Driver/querysim.php:1.21 --- pear/MDB2/MDB2/Driver/querysim.php:1.20 Fri Oct 22 16:56:56 2004 +++ pear/MDB2/MDB2/Driver/querysim.php Wed Oct 27 12:55:28 2004 @@ -61,7 +61,7 @@ // | please contact Alan Richmond. | // +----------------------------------------------------------------------+ // -// $Id: querysim.php,v 1.20 2004/10/22 20:56:56 lsmith Exp $ +// $Id: querysim.php,v 1.21 2004/10/27 16:55:28 lsmith Exp $ // /* @@ -270,8 +270,8 @@ { if ($this->connection != 0) { if (!strcmp($this->connected_database_name, $this->database_name) - && ($this->opened_persistent == $this->options['persistent'])) - { + && ($this->opened_persistent == $this->options['persistent']) + ) { return MDB2_OK; } if ($this->connected_database_name) { http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/sqlite.php?r1=1.32&r2=1.33&ty=u Index: pear/MDB2/MDB2/Driver/sqlite.php diff -u pear/MDB2/MDB2/Driver/sqlite.php:1.32 pear/MDB2/MDB2/Driver/sqlite.php:1.33 --- pear/MDB2/MDB2/Driver/sqlite.php:1.32 Fri Oct 22 16:56:56 2004 +++ pear/MDB2/MDB2/Driver/sqlite.php Wed Oct 27 12:55:28 2004 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ // -// $Id: sqlite.php,v 1.32 2004/10/22 20:56:56 lsmith Exp $ +// $Id: sqlite.php,v 1.33 2004/10/27 16:55:28 lsmith Exp $ // /** @@ -534,10 +534,9 @@ function replace($table, $fields) { $count = count($fields); - for ($keys = 0, $query = $values = '',reset($fields), $colnum = 0; - $colnum < $count; - next($fields), $colnum++) - { + $query = $values = ''; + $keys = $colnum = 0; + for (reset($fields); $colnum < $count; next($fields), $colnum++) { $name = key($fields); if ($colnum > 0) { $query .= ',';
http://cvs.php.net/diff.php/pear/MDB2/MDB2.php?r1=1.51&r2=1.52&ty=u Index: pear/MDB2/MDB2.php diff -u pear/MDB2/MDB2.php:1.51 pear/MDB2/MDB2.php:1.52 --- pear/MDB2/MDB2.php:1.51 Sat Oct 23 12:11:14 2004 +++ pear/MDB2/MDB2.php Wed Oct 27 12:55:26 2004 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ // -// $Id: MDB2.php,v 1.51 2004/10/23 16:11:14 lsmith Exp $ +// $Id: MDB2.php,v 1.52 2004/10/27 16:55:26 lsmith Exp $ // /** @@ -1650,13 +1650,13 @@ $dsn['password'] = $hidepw; } switch ($type) { - // expand to include all possible options - case 'string': - $dsn = $dsn['phptype'].'://'.$dsn['username'].':'. - $dsn['password'].'@'.$dsn['hostspec']. - ($dsn['port'] ? (':'.$dsn['port']) : ''). - '/'.$dsn['database']; - break; + // expand to include all possible options + case 'string': + $dsn = $dsn['phptype'].'://'.$dsn['username'].':'. + $dsn['password'].'@'.$dsn['hostspec']. + ($dsn['port'] ? (':'.$dsn['port']) : ''). + '/'.$dsn['database']; + break; } return $dsn; } @@ -1923,10 +1923,9 @@ 'replace: replace query is not supported'); } $count = count($fields); - for ($keys = 0, $condition = $insert = $values = '', reset($fields), $colnum = 0; - $colnum < $count; - next($fields), $colnum++) - { + $condition = $insert = $values = ''; + $keys = $colnum = 0; + for (reset($fields); $colnum < $count; next($fields), $colnum++) { $name = key($fields); if ($colnum > 0) { $insert .= ', '; http://cvs.php.net/diff.php/pear/MDB2/MDB2/Extended.php?r1=1.11&r2=1.12&ty=u Index: pear/MDB2/MDB2/Extended.php diff -u pear/MDB2/MDB2/Extended.php:1.11 pear/MDB2/MDB2/Extended.php:1.12 --- pear/MDB2/MDB2/Extended.php:1.11 Fri Oct 22 16:43:04 2004 +++ pear/MDB2/MDB2/Extended.php Wed Oct 27 12:55:27 2004 @@ -42,7 +42,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ // -// $Id: Extended.php,v 1.11 2004/10/22 20:43:04 lsmith Exp $ +// $Id: Extended.php,v 1.12 2004/10/27 16:55:27 lsmith Exp $ /** * @package MDB2 @@ -163,39 +163,39 @@ } $first = true; switch ($mode) { - case MDB2_AUTOQUERY_INSERT: - $values = ''; - $names = ''; - while (list(, $value) = each($table_fields)) { - if ($first) { - $first = false; - } else { - $names .= ','; - $values .= ','; - } - $names .= $value; - $values .= '?'; + case MDB2_AUTOQUERY_INSERT: + $values = ''; + $names = ''; + while (list(, $value) = each($table_fields)) { + if ($first) { + $first = false; + } else { + $names .= ','; + $values .= ','; } - return "INSERT INTO $table ($names) VALUES ($values)"; - break; - case MDB2_AUTOQUERY_UPDATE: - $set = ''; - while (list(, $value) = each($table_fields)) { - if ($first) { - $first = false; - } else { - $set .= ','; - } - $set .= "$value = ?"; + $names .= $value; + $values .= '?'; + } + return "INSERT INTO $table ($names) VALUES ($values)"; + break; + case MDB2_AUTOQUERY_UPDATE: + $set = ''; + while (list(, $value) = each($table_fields)) { + if ($first) { + $first = false; + } else { + $set .= ','; } - $query = "UPDATE $table SET $set"; - if ($where) { - $query .= " WHERE $where"; - } - return $query; - break; - default: - $db->raiseError(MDB2_ERROR_SYNTAX); + $set .= "$value = ?"; + } + $query = "UPDATE $table SET $set"; + if ($where) { + $query .= " WHERE $where"; + } + return $query; + break; + default: + $db->raiseError(MDB2_ERROR_SYNTAX); } } http://cvs.php.net/diff.php/pear/MDB2/MDB2/LOB.php?r1=1.8&r2=1.9&ty=u Index: pear/MDB2/MDB2/LOB.php diff -u pear/MDB2/MDB2/LOB.php:1.8 pear/MDB2/MDB2/LOB.php:1.9 --- pear/MDB2/MDB2/LOB.php:1.8 Mon Oct 25 14:05:52 2004 +++ pear/MDB2/MDB2/LOB.php Wed Oct 27 12:55:27 2004 @@ -42,7 +42,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ // -// $Id: LOB.php,v 1.8 2004/10/25 18:05:52 lsmith Exp $ +// $Id: LOB.php,v 1.9 2004/10/27 16:55:27 lsmith Exp $ // @@ -170,9 +170,7 @@ 'MDB2_LOB_Input_File::create: it was specified an invalid input file identifier'); } $this->file = $arguments['file']; - } - else - { + } else { if (isset($arguments['file_name'])) { if ((!$this->file = fopen($arguments['file_name'], 'rb'))) { return MDB2_Driver_Common::raiseError(MDB2_ERROR_NOT_FOUND, null, null, @@ -287,8 +285,8 @@ for ($written = 0; !$this->db->datatype->endOfLOB($this->input_lob) && $written < $buffer_length; - $written += $read) - { + $written += $read + ) { $result = $this->db->datatype->readLOB($this->input_lob, $buffer, $buffer_length); if (MDB2::isError($result)) { return $result; http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/ibase.php?r1=1.44&r2=1.45&ty=u Index: pear/MDB2/MDB2/Driver/ibase.php diff -u pear/MDB2/MDB2/Driver/ibase.php:1.44 pear/MDB2/MDB2/Driver/ibase.php:1.45 --- pear/MDB2/MDB2/Driver/ibase.php:1.44 Tue Oct 26 06:16:26 2004 +++ pear/MDB2/MDB2/Driver/ibase.php Wed Oct 27 12:55:28 2004 @@ -43,7 +43,7 @@ // | Author: Lorenzo Alberton <l.alberton@quipo.it> | // +----------------------------------------------------------------------+ // -// $Id: ibase.php,v 1.44 2004/10/26 10:16:26 quipo Exp $ +// $Id: ibase.php,v 1.45 2004/10/27 16:55:28 lsmith Exp $ /** * MDB2 FireBird/InterBase driver @@ -136,48 +136,48 @@ // try to interpret Interbase error code (that's why we need ibase_errno() // in the interbase module to return the real error code) switch ($native_code) { - case -204: - if (isset($m[3]) && is_int(strpos($m[3], 'Table unknown'))) { - $errno = MDB2_ERROR_NOSUCHTABLE; - } + case -204: + if (isset($m[3]) && is_int(strpos($m[3], 'Table unknown'))) { + $errno = MDB2_ERROR_NOSUCHTABLE; + } + break; + default: + static $ecode_map; + if (empty($ecode_map)) { + $ecode_map = array( + -104 => MDB2_ERROR_SYNTAX, + -150 => MDB2_ERROR_ACCESS_VIOLATION, + -151 => MDB2_ERROR_ACCESS_VIOLATION, + -155 => MDB2_ERROR_NOSUCHTABLE, + 88 => MDB2_ERROR_NOSUCHTABLE, + -157 => MDB2_ERROR_NOSUCHFIELD, + -158 => MDB2_ERROR_VALUE_COUNT_ON_ROW, + -170 => MDB2_ERROR_MISMATCH, + -171 => MDB2_ERROR_MISMATCH, + -172 => MDB2_ERROR_INVALID, + -204 => MDB2_ERROR_INVALID, + -205 => MDB2_ERROR_NOSUCHFIELD, + -206 => MDB2_ERROR_NOSUCHFIELD, + -208 => MDB2_ERROR_INVALID, + -219 => MDB2_ERROR_NOSUCHTABLE, + -297 => MDB2_ERROR_CONSTRAINT, + -303 => MDB2_ERROR_INVALID, + -530 => MDB2_ERROR_CONSTRAINT, + -551 => MDB2_ERROR_ACCESS_VIOLATION, + -552 => MDB2_ERROR_ACCESS_VIOLATION, + -607 => MDB2_ERROR_NOSUCHTABLE, + -803 => MDB2_ERROR_CONSTRAINT, + -904 => MDB2_ERROR_CONNECT_FAILED, + -913 => MDB2_ERROR_DEADLOCK, + -922 => MDB2_ERROR_NOSUCHDB, + -923 => MDB2_ERROR_CONNECT_FAILED, + -924 => MDB2_ERROR_CONNECT_FAILED, + ); + } + if (isset($ecode_map[$native_code])) { + $error = $ecode_map[$native_code]; + } break; - default: - static $ecode_map; - if (empty($ecode_map)) { - $ecode_map = array( - -104 => MDB2_ERROR_SYNTAX, - -150 => MDB2_ERROR_ACCESS_VIOLATION, - -151 => MDB2_ERROR_ACCESS_VIOLATION, - -155 => MDB2_ERROR_NOSUCHTABLE, - 88 => MDB2_ERROR_NOSUCHTABLE, - -157 => MDB2_ERROR_NOSUCHFIELD, - -158 => MDB2_ERROR_VALUE_COUNT_ON_ROW, - -170 => MDB2_ERROR_MISMATCH, - -171 => MDB2_ERROR_MISMATCH, - -172 => MDB2_ERROR_INVALID, - -204 => MDB2_ERROR_INVALID, - -205 => MDB2_ERROR_NOSUCHFIELD, - -206 => MDB2_ERROR_NOSUCHFIELD, - -208 => MDB2_ERROR_INVALID, - -219 => MDB2_ERROR_NOSUCHTABLE, - -297 => MDB2_ERROR_CONSTRAINT, - -303 => MDB2_ERROR_INVALID, - -530 => MDB2_ERROR_CONSTRAINT, - -551 => MDB2_ERROR_ACCESS_VIOLATION, - -552 => MDB2_ERROR_ACCESS_VIOLATION, - -607 => MDB2_ERROR_NOSUCHTABLE, - -803 => MDB2_ERROR_CONSTRAINT, - -904 => MDB2_ERROR_CONNECT_FAILED, - -913 => MDB2_ERROR_DEADLOCK, - -922 => MDB2_ERROR_NOSUCHDB, - -923 => MDB2_ERROR_CONNECT_FAILED, - -924 => MDB2_ERROR_CONNECT_FAILED, - ); - } - if (isset($ecode_map[$native_code])) { - $error = $ecode_map[$native_code]; - } - break; } } else { static $error_regexps; @@ -444,8 +444,8 @@ $connection = ($this->auto_commit ? $this->connection : $this->transaction_id); if ($prepared_query && isset($this->query_parameters[$prepared_query]) - && count($this->query_parameters[$prepared_query]) > 2) - { + && count($this->query_parameters[$prepared_query]) > 2 + ) { $this->query_parameters[$prepared_query][0] = $connection; $this->query_parameters[$prepared_query][1] = $query; $result = @call_user_func_array('ibase_query', $this->query_parameters[$prepared_query]); http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/mssql.php?r1=1.33&r2=1.34&ty=u Index: pear/MDB2/MDB2/Driver/mssql.php diff -u pear/MDB2/MDB2/Driver/mssql.php:1.33 pear/MDB2/MDB2/Driver/mssql.php:1.34 --- pear/MDB2/MDB2/Driver/mssql.php:1.33 Fri Oct 22 17:30:20 2004 +++ pear/MDB2/MDB2/Driver/mssql.php Wed Oct 27 12:55:28 2004 @@ -43,7 +43,7 @@ // | Author: Frank M. Kromann <frank@kromann.info> | // +----------------------------------------------------------------------+ // -// $Id: mssql.php,v 1.33 2004/10/22 21:30:20 lsmith Exp $ +// $Id: mssql.php,v 1.34 2004/10/27 16:55:28 lsmith Exp $ // /** @@ -267,8 +267,8 @@ { if ($this->connection != 0) { if (count(array_diff($this->connected_dsn, $this->dsn)) == 0 - && $this->opened_persistent == $this->options['persistent']) - { + && $this->opened_persistent == $this->options['persistent'] + ) { return MDB2_OK; } $this->_close(); http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/mysql.php?r1=1.32&r2=1.33&ty=u Index: pear/MDB2/MDB2/Driver/mysql.php diff -u pear/MDB2/MDB2/Driver/mysql.php:1.32 pear/MDB2/MDB2/Driver/mysql.php:1.33 --- pear/MDB2/MDB2/Driver/mysql.php:1.32 Fri Oct 22 16:58:30 2004 +++ pear/MDB2/MDB2/Driver/mysql.php Wed Oct 27 12:55:28 2004 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ // -// $Id: mysql.php,v 1.32 2004/10/22 20:58:30 lsmith Exp $ +// $Id: mysql.php,v 1.33 2004/10/27 16:55:28 lsmith Exp $ // /** @@ -353,25 +353,25 @@ $default_table_type = $this->options['default_table_type']; if ($default_table_type) { switch ($this->options['default_table_type'] = strtoupper($default_table_type)) { - case 'BERKELEYDB': - $this->options['default_table_type'] = 'BDB'; - case 'BDB': - case 'INNODB': - case 'GEMINI': - break; - case 'HEAP': - case 'ISAM': - case 'MERGE': - case 'MRG_MYISAM': - case 'MYISAM': - if ($this->supports('transactions')) { - $this->warnings[] = $default_table_type. - ' is not a transaction-safe default table type'; - } - break; - default: + case 'BERKELEYDB': + $this->options['default_table_type'] = 'BDB'; + case 'BDB': + case 'INNODB': + case 'GEMINI': + break; + case 'HEAP': + case 'ISAM': + case 'MERGE': + case 'MRG_MYISAM': + case 'MYISAM': + if ($this->supports('transactions')) { $this->warnings[] = $default_table_type. - ' is not a supported default table type'; + ' is not a transaction-safe default table type'; + } + break; + default: + $this->warnings[] = $default_table_type. + ' is not a supported default table type'; } } @@ -589,10 +589,9 @@ function replace($table, $fields) { $count = count($fields); - for ($keys = 0, $query = $values = '',reset($fields), $colnum = 0; - $colnum < $count; - next($fields), $colnum++) - { + $query = $values = ''; + $keys = $colnum = 0; + for (reset($fields); $colnum < $count; next($fields), $colnum++) { $name = key($fields); if ($colnum > 0) { $query .= ','; http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/oci8.php?r1=1.30&r2=1.31&ty=u Index: pear/MDB2/MDB2/Driver/oci8.php diff -u pear/MDB2/MDB2/Driver/oci8.php:1.30 pear/MDB2/MDB2/Driver/oci8.php:1.31 --- pear/MDB2/MDB2/Driver/oci8.php:1.30 Sat Oct 23 12:06:23 2004 +++ pear/MDB2/MDB2/Driver/oci8.php Wed Oct 27 12:55:28 2004 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ -// $Id: oci8.php,v 1.30 2004/10/23 16:06:23 quipo Exp $ +// $Id: oci8.php,v 1.31 2004/10/27 16:55:28 lsmith Exp $ /** * MDB2 OCI8 driver @@ -296,8 +296,8 @@ } if ($this->connection != 0) { if (count(array_diff($this->connected_dsn, $this->dsn)) == 0 - && $this->opened_persistent == $this->options['persistent']) - { + && $this->opened_persistent == $this->options['persistent'] + ) { return MDB2_OK; } $this->_close(); http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/pgsql.php?r1=1.31&r2=1.32&ty=u Index: pear/MDB2/MDB2/Driver/pgsql.php diff -u pear/MDB2/MDB2/Driver/pgsql.php:1.31 pear/MDB2/MDB2/Driver/pgsql.php:1.32 --- pear/MDB2/MDB2/Driver/pgsql.php:1.31 Fri Oct 22 17:30:20 2004 +++ pear/MDB2/MDB2/Driver/pgsql.php Wed Oct 27 12:55:28 2004 @@ -43,7 +43,7 @@ // | Author: Paul Cooper <pgc@ucecom.com> | // +----------------------------------------------------------------------+ // -// $Id: pgsql.php,v 1.31 2004/10/22 21:30:20 lsmith Exp $ +// $Id: pgsql.php,v 1.32 2004/10/27 16:55:28 lsmith Exp $ /** * MDB2 PostGreSQL driver @@ -309,8 +309,8 @@ if ($this->connection != 0) { if (count(array_diff($this->connected_dsn, $this->dsn)) == 0 && !strcmp($this->connected_database_name, $this->database_name) - && ($this->opened_persistent == $this->options['persistent'])) - { + && ($this->opened_persistent == $this->options['persistent']) + ) { return MDB2_OK; } $this->_close(); http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/querysim.php?r1=1.20&r2=1.21&ty=u Index: pear/MDB2/MDB2/Driver/querysim.php diff -u pear/MDB2/MDB2/Driver/querysim.php:1.20 pear/MDB2/MDB2/Driver/querysim.php:1.21 --- pear/MDB2/MDB2/Driver/querysim.php:1.20 Fri Oct 22 16:56:56 2004 +++ pear/MDB2/MDB2/Driver/querysim.php Wed Oct 27 12:55:28 2004 @@ -61,7 +61,7 @@ // | please contact Alan Richmond. | // +----------------------------------------------------------------------+ // -// $Id: querysim.php,v 1.20 2004/10/22 20:56:56 lsmith Exp $ +// $Id: querysim.php,v 1.21 2004/10/27 16:55:28 lsmith Exp $ // /* @@ -270,8 +270,8 @@ { if ($this->connection != 0) { if (!strcmp($this->connected_database_name, $this->database_name) - && ($this->opened_persistent == $this->options['persistent'])) - { + && ($this->opened_persistent == $this->options['persistent']) + ) { return MDB2_OK; } if ($this->connected_database_name) { http://cvs.php.net/diff.php/pear/MDB2/MDB2/Driver/sqlite.php?r1=1.32&r2=1.33&ty=u Index: pear/MDB2/MDB2/Driver/sqlite.php diff -u pear/MDB2/MDB2/Driver/sqlite.php:1.32 pear/MDB2/MDB2/Driver/sqlite.php:1.33 --- pear/MDB2/MDB2/Driver/sqlite.php:1.32 Fri Oct 22 16:56:56 2004 +++ pear/MDB2/MDB2/Driver/sqlite.php Wed Oct 27 12:55:28 2004 @@ -43,7 +43,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ // -// $Id: sqlite.php,v 1.32 2004/10/22 20:56:56 lsmith Exp $ +// $Id: sqlite.php,v 1.33 2004/10/27 16:55:28 lsmith Exp $ // /** @@ -534,10 +534,9 @@ function replace($table, $fields) { $count = count($fields); - for ($keys = 0, $query = $values = '',reset($fields), $colnum = 0; - $colnum < $count; - next($fields), $colnum++) - { + $query = $values = ''; + $keys = $colnum = 0; + for (reset($fields); $colnum < $count; next($fields), $colnum++) { $name = key($fields); if ($colnum > 0) { $query .= ',';