Update of /cvsroot/phplib/php-lib-stable/php
In directory usw-pr-cvs1:/tmp/cvs-serv18195
Modified Files:
db_mysql.inc
Log Message:
Sync with -devel tree:
clean up whitespace and comments
move the table_names() function
use -devel version of table_names() function which does not use $this->query()
Index: db_mysql.inc
===================================================================
RCS file: /cvsroot/phplib/php-lib-stable/php/db_mysql.inc,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** db_mysql.inc 2001/08/13 23:12:01 1.6
--- db_mysql.inc 2001/08/21 02:20:04 1.7
***************
*** 151,155 ****
$this->Row = $pos;
else {
! $this->halt("seek($pos) failed: result has ".$this->num_rows()." rows");
/* half assed attempt to save the day,
--- 151,155 ----
$this->Row = $pos;
else {
! $this->halt("seek($pos) failed: result has ".$this->num_rows()." rows.");
/* half assed attempt to save the day,
***************
*** 201,205 ****
}
-
/* public: evaluate the result (size, width) */
function affected_rows() {
--- 201,204 ----
***************
*** 274,278 ****
/* public: return table metadata */
! function metadata($table='',$full=false) {
$count = 0;
$id = 0;
--- 273,277 ----
/* public: return table metadata */
! function metadata($table = "", $full = false) {
$count = 0;
$id = 0;
***************
*** 301,305 ****
* [0]["flags"] field flags
* ["meta"][field name] index of field named "field name"
! * The last one is used, if you have a field name, but no index.
* Test: if (isset($result['meta']['myfield'])) { ...
*/
--- 300,304 ----
* [0]["flags"] field flags
* ["meta"][field name] index of field named "field name"
! * This last one could be used if you have a field name, but no index.
* Test: if (isset($result['meta']['myfield'])) { ...
*/
***************
*** 347,354 ****
// free the result only if we were called on a table
! if ($table) @mysql_free_result($id);
return $res;
}
/* private: error handling */
function halt($msg) {
--- 346,371 ----
// free the result only if we were called on a table
! if ($table) {
! @mysql_free_result($id);
! }
return $res;
}
+ /* public: find available table names */
+ function table_names() {
+ $this->connect();
+ $h = @mysql_query("show tables", $this->Link_ID);
+ $i = 0;
+ while ($info = @mysql_fetch_row($h)) {
+ $return[$i]["table_name"] = $info[0];
+ $return[$i]["tablespace_name"] = $this->Database;
+ $return[$i]["database"] = $this->Database;
+ $i++;
+ }
+
+ @mysql_free_result($h);
+ return $return;
+ }
+
/* private: error handling */
function halt($msg) {
***************
*** 371,386 ****
}
- function table_names() {
- $this->query("SHOW TABLES");
- $i=0;
- while ($info=mysql_fetch_row($this->Query_ID))
- {
- $return[$i]["table_name"]= $info[0];
- $return[$i]["tablespace_name"]=$this->Database;
- $return[$i]["database"]=$this->Database;
- $i++;
- }
- return $return;
- }
}
?>
--- 388,391 ----
|