diff options
| author | Damien Regad <dregad@mantisbt.org> | 2023-04-30 01:00:55 +0200 |
|---|---|---|
| committer | Damien Regad <dregad@mantisbt.org> | 2023-04-30 01:00:55 +0200 |
| commit | ae2438b731d24bf0bb159a738599b9266120e96e (patch) | |
| tree | 356f49f75db5090487707348eea1307dc8e5bcdf /drivers | |
| parent | aef9e9459712c9da90e9d83f1f4e7b8f21245a56 (diff) | |
| download | adodb-ae2438b731d24bf0bb159a738599b9266120e96e.tar.gz adodb-ae2438b731d24bf0bb159a738599b9266120e96e.tar.bz2 adodb-ae2438b731d24bf0bb159a738599b9266120e96e.zip | |
Define ADOConnection::_query() method
- Update child classes to be consistent with this declaration.
- Remove unnecessary, non-PHPDoc comments
- Consistent parameter names
Fixes #966
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/adodb-ado.inc.php | 4 | ||||
| -rw-r--r-- | drivers/adodb-ado5.inc.php | 1 | ||||
| -rw-r--r-- | drivers/adodb-ads.inc.php | 1 | ||||
| -rw-r--r-- | drivers/adodb-fbsql.inc.php | 1 | ||||
| -rw-r--r-- | drivers/adodb-firebird.inc.php | 20 | ||||
| -rw-r--r-- | drivers/adodb-ibase.inc.php | 18 | ||||
| -rw-r--r-- | drivers/adodb-informix72.inc.php | 1 | ||||
| -rw-r--r-- | drivers/adodb-ldap.inc.php | 1 | ||||
| -rw-r--r-- | drivers/adodb-mssql.inc.php | 1 | ||||
| -rw-r--r-- | drivers/adodb-mysqli.inc.php | 14 | ||||
| -rw-r--r-- | drivers/adodb-oci8.inc.php | 8 | ||||
| -rw-r--r-- | drivers/adodb-oci8po.inc.php | 11 | ||||
| -rw-r--r-- | drivers/adodb-odbc.inc.php | 1 | ||||
| -rw-r--r-- | drivers/adodb-oracle.inc.php | 1 | ||||
| -rw-r--r-- | drivers/adodb-pdo.inc.php | 1 | ||||
| -rw-r--r-- | drivers/adodb-postgres64.inc.php | 1 | ||||
| -rw-r--r-- | drivers/adodb-sqlite.inc.php | 1 | ||||
| -rw-r--r-- | drivers/adodb-sqlite3.inc.php | 1 | ||||
| -rw-r--r-- | drivers/adodb-sybase.inc.php | 1 | ||||
| -rw-r--r-- | drivers/adodb-text.inc.php | 23 |
20 files changed, 58 insertions, 53 deletions
diff --git a/drivers/adodb-ado.inc.php b/drivers/adodb-ado.inc.php index fc000cec..a0b6ffa9 100644 --- a/drivers/adodb-ado.inc.php +++ b/drivers/adodb-ado.inc.php @@ -208,10 +208,6 @@ class ADODB_ado extends ADOConnection { return empty($arr) ? $false : $arr; } - - - - /* returns queryID or false */ function _query($sql,$inputarr=false) { diff --git a/drivers/adodb-ado5.inc.php b/drivers/adodb-ado5.inc.php index 36f9c3b8..8b641cf7 100644 --- a/drivers/adodb-ado5.inc.php +++ b/drivers/adodb-ado5.inc.php @@ -233,7 +233,6 @@ class ADODB_ado extends ADOConnection { return $arr; } - /* returns queryID or false */ function _query($sql,$inputarr=false) { try { // In PHP5, all COM errors are exceptions, so to maintain old behaviour... diff --git a/drivers/adodb-ads.inc.php b/drivers/adodb-ads.inc.php index 8b877b6d..16eec976 100644 --- a/drivers/adodb-ads.inc.php +++ b/drivers/adodb-ads.inc.php @@ -564,7 +564,6 @@ class ADODB_ads extends ADOConnection return array($sql, $stmt, false); } - /* returns queryID or false */ function _query($sql, $inputarr = false) { $last_php_error = $this->resetLastError(); diff --git a/drivers/adodb-fbsql.inc.php b/drivers/adodb-fbsql.inc.php index a4255eb9..64913bc2 100644 --- a/drivers/adodb-fbsql.inc.php +++ b/drivers/adodb-fbsql.inc.php @@ -134,7 +134,6 @@ class ADODB_fbsql extends ADOConnection { } - // returns queryID or false function _query($sql,$inputarr=false) { return fbsql_query("$sql;",$this->_connectionID); diff --git a/drivers/adodb-firebird.inc.php b/drivers/adodb-firebird.inc.php index 133d9f43..db3cca5d 100644 --- a/drivers/adodb-firebird.inc.php +++ b/drivers/adodb-firebird.inc.php @@ -483,14 +483,14 @@ class ADODB_firebird extends ADOConnection { } /** - * Return the query id. - * - * @param string|array $sql - * @param array $iarr - * - * @return bool|object - */ - function _query($sql, $iarr = false) + * Execute a query. + * + * @param string|array $sql Query to execute. + * @param array $inputarr An optional array of parameters. + * + * @return object|bool Query identifier or true if execution successful, false if failed. + */ + function _query($sql, $inputarr = false) { if (!$this->isConnected()) { return false; @@ -512,8 +512,8 @@ class ADODB_firebird extends ADOConnection { $fn = 'fbird_query'; $args = [$conn, $sql]; } - if (is_array($iarr)) { - $args = array_merge($args, $iarr); + if (is_array($inputarr)) { + $args = array_merge($args, $inputarr); } $ret = call_user_func_array($fn, $args); diff --git a/drivers/adodb-ibase.inc.php b/drivers/adodb-ibase.inc.php index 25a9c3e8..fe9e033b 100644 --- a/drivers/adodb-ibase.inc.php +++ b/drivers/adodb-ibase.inc.php @@ -332,7 +332,7 @@ class ADODB_ibase extends ADOConnection { // returns query ID if successful, otherwise false // there have been reports of problems with nested queries - the code is probably not re-entrant? - function _query($sql,$iarr=false) + function _query($sql, $inputarr = false) { if (!$this->autoCommit && $this->_transactionID) { $conn = $this->_transactionID; @@ -344,11 +344,11 @@ class ADODB_ibase extends ADOConnection { if (is_array($sql)) { $fn = 'ibase_execute'; $sql = $sql[1]; - if (is_array($iarr)) { - if (!isset($iarr[0])) { - $iarr[0] = ''; // PHP5 compat hack + if (is_array($inputarr)) { + if (!isset($inputarr[0])) { + $inputarr[0] = ''; // PHP5 compat hack } - $fnarr = array_merge(array($sql), $iarr); + $fnarr = array_merge(array($sql), $inputarr); $ret = call_user_func_array($fn, $fnarr); } else { $ret = $fn($sql); @@ -356,11 +356,11 @@ class ADODB_ibase extends ADOConnection { } else { $fn = 'ibase_query'; - if (is_array($iarr)) { - if (sizeof($iarr) == 0) { - $iarr[0] = ''; // PHP5 compat hack + if (is_array($inputarr)) { + if (sizeof($inputarr) == 0) { + $inputarr[0] = ''; // PHP5 compat hack } - $fnarr = array_merge(array($conn, $sql), $iarr); + $fnarr = array_merge(array($conn, $sql), $inputarr); $ret = call_user_func_array($fn, $fnarr); } else { $ret = $fn($conn, $sql); diff --git a/drivers/adodb-informix72.inc.php b/drivers/adodb-informix72.inc.php index 759bd5c8..6fddde3d 100644 --- a/drivers/adodb-informix72.inc.php +++ b/drivers/adodb-informix72.inc.php @@ -334,7 +334,6 @@ class ADODB_informix72 extends ADOConnection { else return array($sql,$stmt); } */ - // returns query ID if successful, otherwise false function _query($sql,$inputarr=false) { global $ADODB_COUNTRECS; diff --git a/drivers/adodb-ldap.inc.php b/drivers/adodb-ldap.inc.php index 323b3585..305f6a7f 100644 --- a/drivers/adodb-ldap.inc.php +++ b/drivers/adodb-ldap.inc.php @@ -157,7 +157,6 @@ class ADODB_ldap extends ADOConnection { } } - /* returns _queryID or false */ function _query($sql,$inputarr=false) { $rs = @ldap_search( $this->_connectionID, $this->database, $sql ); diff --git a/drivers/adodb-mssql.inc.php b/drivers/adodb-mssql.inc.php index 269dd7ed..c0b714ed 100644 --- a/drivers/adodb-mssql.inc.php +++ b/drivers/adodb-mssql.inc.php @@ -725,7 +725,6 @@ order by constraint_name, referenced_table_name, keyno"; return $this->Execute($sql) != false; } - // returns query ID if successful, otherwise false function _query($sql,$inputarr=false) { $this->_errorMsg = false; diff --git a/drivers/adodb-mysqli.inc.php b/drivers/adodb-mysqli.inc.php index dcdb487b..8dc67b88 100644 --- a/drivers/adodb-mysqli.inc.php +++ b/drivers/adodb-mysqli.inc.php @@ -1179,14 +1179,14 @@ class ADODB_mysqli extends ADOConnection { } /** - * Return the query id. - * - * @param string|array $sql - * @param array $inputarr - * - * @return bool|mysqli_result + * Execute a query. + * + * @param string|array $sql Query to execute. + * @param array $inputarr An optional array of parameters. + * + * @return mysqli_result|bool */ - function _query($sql, $inputarr) + function _query($sql, $inputarr = false) { global $ADODB_COUNTRECS; // Move to the next recordset, or return false if there is none. In a stored proc diff --git a/drivers/adodb-oci8.inc.php b/drivers/adodb-oci8.inc.php index 211fa9a2..f361d683 100644 --- a/drivers/adodb-oci8.inc.php +++ b/drivers/adodb-oci8.inc.php @@ -1272,7 +1272,8 @@ END; } /** - * returns query ID if successful, otherwise false + * Execute a query. + * * this version supports: * * 1. $db->execute('select * from table'); @@ -1285,6 +1286,11 @@ END; * 4. $db->prepare('insert into table (a,b,c) values (:0,:1,:2)'); * $db->bind($stmt,1); $db->bind($stmt,2); $db->bind($stmt,3); * $db->execute($stmt); + * + * @param string|array $sql Query to execute. + * @param array $inputarr An optional array of parameters. + * + * @return mixed|bool Query identifier or true if execution successful, false if failed. */ function _query($sql,$inputarr=false) { diff --git a/drivers/adodb-oci8po.inc.php b/drivers/adodb-oci8po.inc.php index aaf4bb5f..71c203b6 100644 --- a/drivers/adodb-oci8po.inc.php +++ b/drivers/adodb-oci8po.inc.php @@ -70,7 +70,16 @@ class ADODB_oci8po extends ADODB_oci8 { return ADOConnection::SelectLimit($sql, $nrows, $offset, $inputarr, $secs2cache); } - // emulate handling of parameters ? ?, replacing with :bind0 :bind1 + /** + * Execute a query. + * + * Emulate handling of parameters ? ?, replacing with :bind0 :bind1 + * + * @param string|array $sql Query to execute. + * @param array $inputarr An optional array of parameters. + * + * @return mixed|bool Query identifier or true if execution successful, false if failed. + */ function _query($sql,$inputarr=false) { if (is_array($inputarr)) { diff --git a/drivers/adodb-odbc.inc.php b/drivers/adodb-odbc.inc.php index 508711a3..9b214c53 100644 --- a/drivers/adodb-odbc.inc.php +++ b/drivers/adodb-odbc.inc.php @@ -518,7 +518,6 @@ See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/od return array($sql,$stmt,false); } - /* returns queryID or false */ function _query($sql,$inputarr=false) { $last_php_error = $this->resetLastError(); diff --git a/drivers/adodb-oracle.inc.php b/drivers/adodb-oracle.inc.php index 1a2735b1..dc0462fe 100644 --- a/drivers/adodb-oracle.inc.php +++ b/drivers/adodb-oracle.inc.php @@ -181,7 +181,6 @@ class ADODB_oracle extends ADOConnection { } - // returns query ID if successful, otherwise false function _query($sql,$inputarr=false) { // <G. Giunta 2003/03/03/> Reset error messages before executing diff --git a/drivers/adodb-pdo.inc.php b/drivers/adodb-pdo.inc.php index 0fbe3e2f..d3ce12d0 100644 --- a/drivers/adodb-pdo.inc.php +++ b/drivers/adodb-pdo.inc.php @@ -578,7 +578,6 @@ class ADODB_pdo extends ADOConnection { } - /* returns queryID or false */ function _query($sql,$inputarr=false) { $ok = false; diff --git a/drivers/adodb-postgres64.inc.php b/drivers/adodb-postgres64.inc.php index 23a21958..9bf9e713 100644 --- a/drivers/adodb-postgres64.inc.php +++ b/drivers/adodb-postgres64.inc.php @@ -784,7 +784,6 @@ class ADODB_postgres64 extends ADOConnection{ } - // returns queryID or false function _query($sql,$inputarr=false) { $this->_pnum = 0; diff --git a/drivers/adodb-sqlite.inc.php b/drivers/adodb-sqlite.inc.php index 0711f1dd..d41829c0 100644 --- a/drivers/adodb-sqlite.inc.php +++ b/drivers/adodb-sqlite.inc.php @@ -211,7 +211,6 @@ class ADODB_sqlite extends ADOConnection { return true; } - // returns query ID if successful, otherwise false function _query($sql,$inputarr=false) { $rez = sqlite_query($sql,$this->_connectionID); diff --git a/drivers/adodb-sqlite3.inc.php b/drivers/adodb-sqlite3.inc.php index 318171a8..7623a3c8 100644 --- a/drivers/adodb-sqlite3.inc.php +++ b/drivers/adodb-sqlite3.inc.php @@ -331,7 +331,6 @@ class ADODB_sqlite3 extends ADOConnection { return $this->_connect($argHostname, $argUsername, $argPassword, $argDatabasename); } - // returns query ID if successful, otherwise false function _query($sql,$inputarr=false) { $rez = $this->_connectionID->query($sql); diff --git a/drivers/adodb-sybase.inc.php b/drivers/adodb-sybase.inc.php index 5eb217a8..79fb82e8 100644 --- a/drivers/adodb-sybase.inc.php +++ b/drivers/adodb-sybase.inc.php @@ -170,7 +170,6 @@ class ADODB_sybase extends ADOConnection { return true; } - // returns query ID if successful, otherwise false function _query($sql,$inputarr=false) { global $ADODB_COUNTRECS; diff --git a/drivers/adodb-text.inc.php b/drivers/adodb-text.inc.php index 77ad06a0..36a1a0d4 100644 --- a/drivers/adodb-text.inc.php +++ b/drivers/adodb-text.inc.php @@ -129,14 +129,21 @@ class ADODB_text extends ADOConnection { return true; } - - - // returns queryID or false - // We presume that the select statement is on the same table (what else?), - // with the only difference being the order by. - //You can filter by using $eval and each clause is stored in $arr .eg. $arr[1] == 'name' - // also supports SELECT [DISTINCT] COL FROM ... -- only 1 col supported - function _query($sql,$input_arr,$eval=false) + /** + * Execute a query. + * + * We presume that the select statement is on the same table (what else?), + * with the only difference being the order by. + * You can filter by using $eval and each clause is stored in $arr e.g. $arr[1] == 'name' + * also supports SELECT [DISTINCT] COL FROM ... -- only 1 col supported + * + * @param string|array $sql Query to execute. + * @param array $inputarr An optional array of parameters. + * @param string $eval Optional eval string + * + * @return mixed|bool Query identifier or true if execution successful, false if failed. + */ + function _query($sql, $inputarr=false, $eval=false) { if ($this->_origarray === false) return false; |
