diff --git a/phpBB/db/mssql.php b/phpBB/db/mssql.php index 96a0f925c0..96bb0a3aff 100644 --- a/phpBB/db/mssql.php +++ b/phpBB/db/mssql.php @@ -70,20 +70,10 @@ class sql_db } return $this->db_connect_id; } + // // Other base methods // - function sql_setdb($database) - { - $this->dbname = $database; - $dbselect = @mssql_select_db($this->dbname); - if(!$dbselect) - { - sql_close(); - $this->db_connect_id = $dbselect; - } - return $this->db_connect_id; - } function sql_close() { if($this->db_connect_id) @@ -170,6 +160,9 @@ class sql_db { $this->query_result = @mssql_query($query, $this->db_connect_id); + $next_id_query = @mssql_query("SELECT @@ROWCOUNT AS this_count"); + $this->affected_rows[$this->query_result] = $this->sql_fetchfield("this_count", -1, $next_id_query); + $this->query_limit_offset[$this->query_result] = -1; $this->query_limit_numrows[$this->query_result] = -1; } @@ -208,6 +201,21 @@ class sql_db return false; } } + function sql_affectedrows($query_id = 0) + { + if(!$query_id) + { + $query_id = $this->query_result; + } + if($query_id) + { + return $affected_rows[$query_id]; + } + else + { + return false; + } + } function sql_numfields($query_id = 0) { if(!$query_id) diff --git a/phpBB/db/mysql.php b/phpBB/db/mysql.php index ec64731a68..8aa055640c 100644 --- a/phpBB/db/mysql.php +++ b/phpBB/db/mysql.php @@ -74,24 +74,6 @@ class sql_db // // Other base methods // - function sql_setdb($database) - { - if($database != "") - { - $this->dbname = $database; - $dbselect = @mysql_select_db($this->dbname); - if(!$dbselect) - { - sql_close(); - $this->db_connect_id = $dbselect; - } - return $this->db_connect_id; - } - else - { - return false; - } - } function sql_close() { if($this->db_connect_id) @@ -151,6 +133,22 @@ class sql_db return false; } } + function sql_affectedrows($query_id = 0) + { + if(!$query_id) + { + $query_id = $this->query_result; + } + if($query_id) + { + $result = @mysql_affected_rows($query_id); + return $result; + } + else + { + return false; + } + } function sql_numfields($query_id = 0) { if(!$query_id) diff --git a/phpBB/db/odbc.php b/phpBB/db/odbc.php index f55fa178e7..063608ab33 100644 --- a/phpBB/db/odbc.php +++ b/phpBB/db/odbc.php @@ -96,10 +96,6 @@ class sql_db // // Other base methods // - function sql_setdb($database) - { - return false; - } function sql_close() { if($this->db_connect_id) @@ -257,6 +253,21 @@ class sql_db return false; } } + function sql_affectedrows($query_id = 0) + { + if(!$query_id) + { + $query_id = $this->query_result; + } + if($query_id) + { + return $this->@odbc_num_rows[$query_id]; + } + else + { + return false; + } + } function sql_numfields($query_id = 0) { if(!$query_id) diff --git a/phpBB/db/oracle.php b/phpBB/db/oracle.php index 0c9f63d5f2..edfe3749c9 100644 --- a/phpBB/db/oracle.php +++ b/phpBB/db/oracle.php @@ -64,11 +64,6 @@ class sql_db // // Other base methods // - function sql_setdb($database) - { - // This method does not exist in Oracle. - return true; - } function sql_close() { if($this->db_connect_id) @@ -149,6 +144,22 @@ class sql_db return false; } } + function sql_affectedrows($query_id = 0) + { + if(!$query_id) + { + $query_id = $this->query_result; + } + if($query_id) + { + $result = @OCIRowCount($query_id); + return $result; + } + else + { + return false; + } + } function sql_numfields($query_id = 0) { if(!$query_id) diff --git a/phpBB/db/postgres7.php b/phpBB/db/postgres7.php index 2e1bff674d..3b0eac607f 100644 --- a/phpBB/db/postgres7.php +++ b/phpBB/db/postgres7.php @@ -92,40 +92,6 @@ class sql_db // // Other base methods // - function sql_setdb($database) - { - if($this->db_connect_id) - { - if($this->query_result) - { - @pg_freeresult($this->query_result); - unset($this->query_result); - unset($this->row); - } - $result = @pg_close($this->db_connect_id); - if($result) - { - $this->dbname = $database; - $make_connect = $this->connect_string . "dbname=$database"; - if($this->persistency) - { - $this->db_connect_id = @pg_pconnect($make_connect); - } - else - { - $this->db_connect_id = @pg_connect($make_connect); - } - } - } - if($this->db_connect_id) - { - return $this->db_connect_id; - } - else - { - return false; - } - } function sql_close() { if($this->db_connect_id) @@ -192,6 +158,22 @@ class sql_db return false; } } + function sql_affectedrows($query_id = 0) + { + if(!$query_id) + { + $query_id = $this->query_result; + } + if($query_id) + { + $result = @pg_cmdtuples($query_id); + return $result; + } + else + { + return false; + } + } function sql_numfields($query_id = 0) { if(!$query_id)