Date: 11/11/99
- Next message: kk: "[PHPLIB-DEV] cvs commit"
- Previous message: athompso: "[PHPLIB-DEV] cvs commit"
- Next in thread: kk: "[PHPLIB-DEV] cvs commit"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
From: kk
Date: Thu Nov 11 21:42:17 1999
Modified files:
php-lib/CHANGES
php-lib/php/db_msql.inc
php-lib/php/db_mysql.inc
php-lib/php/db_mssql.inc
Log message:
Cleaning up the database API (mssql, mysql, msql)
I do not have all databases here at hand, only mysql. I am committing
these changes blindly and untested. If you have any feedback, please
let me hear about it.
Index: php-lib/CHANGES
diff -u php-lib/CHANGES:1.146 php-lib/CHANGES:1.147
--- php-lib/CHANGES:1.146 Thu Nov 11 13:40:56 1999
+++ php-lib/CHANGES Thu Nov 11 21:41:46 1999
@@ -1,5 +1,13 @@
-$Id: CHANGES,v 1.146 1999/11/11 12:40:56 negro Exp $
+$Id: CHANGES,v 1.147 1999/11/11 20:41:46 kk Exp $
+11-Nov-1999 kk
+ - Modelled db_msql.inc after db_mysql.inc to bringt database API up
+ to current revision. Have no msql running, so I cannot test it.
+ - Modelled db_mssql.inc after db_mysql.inc, but some functions
+ are mission, because I do not know anything about mssql. Would
+ like to get a lock, unlock, table_names and nextid function.
+ Would like to get bug reports or even better: patches!
+
11-Nov-1999 negro
- Checked in a draft implementation of ct_sql_blob, a container
using blob storage engine as proposed by Sascha and implemented
@@ -15,8 +23,8 @@
if(@$debug) this time. I don't think this is a problem...
10-Nov-1999 kk
- - Hey, it is much faster this way. We do not need to call a PHP
- interpreter for each button we create!
+ - Eliminated button.php3: it is much faster this way. We do not need to
+ call a PHP interpreter for each button we create!
06-Nov-1999 kk
- Menu_Button now has mouseover capabilities; button.php3
Index: php-lib/php/db_msql.inc
diff -u php-lib/php/db_msql.inc:1.5 php-lib/php/db_msql.inc:1.6
--- php-lib/php/db_msql.inc:1.5 Wed Oct 27 15:17:34 1999
+++ php-lib/php/db_msql.inc Thu Nov 11 21:41:46 1999
@@ -7,115 +7,173 @@
*
* Derived from db_mysql.inc by Sascha Schumann <sascha <email protected>>
*
- * $Id: db_msql.inc,v 1.5 1999/10/27 13:17:34 kk Exp $
+ * $Id: db_msql.inc,v 1.6 1999/11/11 20:41:46 kk Exp $
*
*/
class DB_Sql {
+
+ /* public: connection parameters */
var $Host = "";
var $Database = "";
- var $Link_ID = 0;
- var $Query_ID = 0;
+ /* public: configuration parameters */
+ var $Auto_Free = 0; ## Set this to 1 for automatic msql_free_result()
+ var $Debug = 0; ## Set this to 1 for debugging messages.
+ var $Halt_On_Error = "yes"; ## "yes", "report" or "no"
+ var $Seq_Table = "db_sequence";
+
+ /* public: result array and current row number */
var $Record = array();
var $Row;
+ /* public: current error number and error text */
var $Error = "";
+
+ /* public: this is an api revision, not a CVS revision */
+ var $type = "msql";
+ var $revision = "1.2";
- var $Auto_Free = 0; ## Set this to 1 for automatic msql_free_result()
+ /* private: link and query handles */
+ var $Link_ID = 0;
+ var $Query_ID = 0;
+
+ /* public: constructor */
+ function DB_Sql($query = "") {
+ $this->query($query);
+ }
- function connect() {
- // Not connected? Then connect?
+ /* public: some trivial reporting */
+ function link_id() {
+ return $this->Link_ID;
+ }
+
+ function query_id() {
+ return $this->Query_ID;
+ }
+
+ /* public: connection management */
+ function connect($Database = "", $Host = "") {
+ /* Handle defaults */
+ if ("" == $Database)
+ $Database = $this->Database;
+
+ if ("" == $Host)
+ $Host = $this->Host;
+
+ /* establish connection, select database */
if ( 0 == $this->Link_ID ) {
// Check for local connect
- $this->Link_ID = empty($this->Host)?
+ $this->Link_ID = empty($Host)?
$this->Link_ID=msql_pconnect():
- $this->Link_ID=msql_pconnect($this->Host);
+ $this->Link_ID=msql_pconnect($Host);
}
// Still not connected? Raise error.
if ( 0 == $this->Link_ID ) {
- $this->halt("Link-ID == false, pconnect failed");
+ $this->halt("pconnect($Host) failed.");
+ return 0;
}
// Select current database
- if (!msql_select_db($this->Database, $this->Link_ID)) {
- $this->halt("cannot use database ".$this->Database);
+ if (! <email protected>($Database, $this->Link_ID)) {
+ $this->halt("cannot use database ".$Database);
}
+
+ return $this->Link_ID;
}
- function query($Query_String) {
- $this->connect();
+ /* public: discard the query result */
+ function free() {
+ <email protected>($this->Query_ID);
+ $this->Query_ID = 0;
+ }
-# printf("Debug: query = %s<br>\n", $Query_String);
+ /* public: perform a query */
+ function query($Query_String) {
+ /* No empty queries, please. */
+ if ($Query_String == "")
+ return 0;
+
+ if (!$this->connect())
+ return 0; /* we already complained in connect() about that. */
+
+ if ($this->Query_ID)
+ $this->free(); /* discard previous result */
+
+ if ($this->Debug)
+ printf("Debug: query = %s<br>\n", $Query_String);
- $this->Query_ID = msql_query($Query_String,$this->Link_ID);
+ $this->Query_ID = <email protected>($Query_String,$this->Link_ID);
$this->Row = 0;
$this->Error = msql_error();
if (!$this->Query_ID) {
$this->halt("Invalid SQL: ".$Query_String);
}
+ /* will return false if query failed. This is okay with us. */
return $this->Query_ID;
}
+ /* public: walk result set */
function next_record() {
- $this->Record = msql_fetch_array($this->Query_ID);
+ if (!$this->Query_Id) {
+ $this->halt("next_record called with no query pending.");
+ return 0;
+ }
+
+ $this->Record = <email protected>($this->Query_ID);
$this->Row += 1;
$this->Error = msql_error();
$stat = is_array($this->Record);
if (!$stat && $this->Auto_Free) {
- msql_free_result($this->Query_ID);
- $this->Query_ID = 0;
+ $this->free();
}
return $stat;
}
- function seek($pos) {
- $status = msql_data_seek($this->Query_ID, $pos);
+ /* public: position in result set */
+ function seek($pos = 0) {
+ $status = <email protected>($this->Query_ID, $pos);
if ($status)
$this->Row = $pos;
- return;
- }
-
- function metadata($table) {
- $count = 0;
- $id = 0;
- $res = array();
-
- $this->connect();
- $id = <email protected>($this->Database, $table);
- if ($id < 0) {
- $this->Error = msql_error();
- $this->halt("Metadata query failed.");
- }
- $count = msql_num_fields($id);
-
- for ($i=0; $i<$count; $i++) {
- $res[$i]["table"] = msql_fieldtable ($id, $i);
- $res[$i]["name"] = msql_fieldname ($id, $i);
- $res[$i]["type"] = msql_fieldtype ($id, $i);
- $res[$i]["len"] = msql_fieldlen ($id, $i);
- $res[$i]["flags"] = msql_fieldflags ($id, $i);
- $res["meta"][$res[$i]["name"]] = $i;
- $res["num_fields"]= $count;
+ else {
+ $this->halt("seek($pos) failed: result has ".$this->num_rows()." rows.");
+
+ /* half assed attempt to save the day,
+ * but do not consider this documented or even
+ * desireable behaviour.
+ */
+ <email protected>($this->Query_ID, $this->num_rows());
+ $this->Row = $this->num_rows();
+ return 0
}
- msql_free_result($id);
- return $res;
+ return 1;
}
+ /* public: table locking */
+ function lock($table, $mode="write") {
+ $this->halt("Does msql have table locking functions?");
+ return false;
+ }
+
+ function unlock() {
+ $this->halt("Does msql have table locking functions?");
+ }
+
+ /* public: evaluate the result (size, width) */
function affected_rows() {
- return msql_affected_rows($this->Query_ID);
+ return <email protected>($this->Query_ID);
}
function num_rows() {
- return msql_num_rows($this->Query_ID);
+ return <email protected>($this->Query_ID);
}
function num_fields() {
- return msql_num_fields($this->Query_ID);
+ return <email protected>($this->Query_ID);
}
function nf() {
@@ -133,11 +191,129 @@
function p($Name) {
print $this->Record[$Name];
}
+
+ /* public: sequence numbers */
+ /* This will not work unless somebody implements locking functions. */
+ function nextid($seq_name) {
+ $this->connect();
+
+ if ($this->lock($this->Seq_Table)) {
+ /* get sequence number (locked) and increment */
+ $q = sprintf("select nextid from %s where seq_name = '%s'",
+ $this->Seq_Table,
+ $seq_name);
+ $id = <email protected>($q, $this->Link_ID);
+ $res = <email protected>($id);
+
+ /* No current value, make one */
+ if (!is_array($res)) {
+ $currentid = 0;
+ $q = sprintf("insert into %s values('%s', %s)",
+ $this->Seq_Table,
+ $seq_name,
+ $currentid);
+ $id = <email protected>($q, $this->Link_ID);
+ } else {
+ $currentid = $res["nextid"];
+ }
+ $nextid = $currentid + 1;
+ $q = sprintf("update %s set nextid = '%s' where seq_name = '%s'",
+ $this->Seq_Table,
+ $nextid,
+ $seq_name);
+ $id = <email protected>($q, $this->Link_ID);
+ $this->unlock();
+ } else {
+ $this->halt("cannot lock ".$this->Seq_Table." - has it been created?");
+ return 0;
+ }
+ return $nextid;
+ }
+ /* public: return table metadata */
+ function metadata($table = "", $full = false) {
+ $count = 0;
+ $id = 0;
+ $res = array();
+
+ /* if no $table specified, we assume to be working with a query result */
+ if ($table) {
+ $this->connect();
+ $id = <email protected>($this->Database, $table);
+ if (!$id) {
+ $this->halt("Metadata query failed.");
+ return false;
+ }
+ } else {
+ $id = $this->Query_ID;
+ if (!$id) {
+ $this->halt("No query specified.");
+ return false;
+ }
+ }
+
+ $count = <email protected>($id);
+
+ if (!$full) {
+ for ($i=0; $i<$count; $i++) {
+ $res[$i]["table"] = msql_fieldtable ($id, $i);
+ $res[$i]["name"] = msql_fieldname ($id, $i);
+ $res[$i]["type"] = msql_fieldtype ($id, $i);
+ $res[$i]["len"] = msql_fieldlen ($id, $i);
+ $res[$i]["flags"] = msql_fieldflags ($id, $i);
+ }
+ } else {
+ $res["num_fields"]= $count;
+
+ for ($i=0; $i<$count; $i++) {
+ $res[$i]["table"] = msql_fieldtable ($id, $i);
+ $res[$i]["name"] = msql_fieldname ($id, $i);
+ $res[$i]["type"] = msql_fieldtype ($id, $i);
+ $res[$i]["len"] = msql_fieldlen ($id, $i);
+ $res[$i]["flags"] = msql_fieldflags ($id, $i);
+ $res["meta"][$res[$i]["name"]] = $i;
+ }
+ }
+
+ /* we must not free foreign query results */
+ if ($table)
+ <email protected>($id);
+
+ return $res;
+ }
+
+ /* public: find available table names */
+ function table_names() {
+ $this->connect();
+ $h = <email protected>("show tables", $this->Link_ID);
+ $i = 0;
+ while ($info = <email protected>($h)) {
+ $return[$i]["table_name"] = $info[0];
+ $return[$i]["tablespace_name"] = $this->Database;
+ $return[$i]["database"] = $this->Database;
+ $i++;
+ }
+
+ <email protected>($h);
+ return $return;
+ }
+
+ /* private: error handling */
function halt($msg) {
+ $this->Error = <email protected>($this->Link_ID);
+ if ($this->Halt_On_Error == "no")
+ return;
+
+ $this->haltmsg($msg);
+
+ if ($this->Halt_On_Error != "report")
+ die("Session halted.");
+ }
+
+ function haltmsg($msg) {
printf("</td></tr></table><b>Database error:</b> %s<br>\n", $msg);
printf("<b>MSQL Error</b>: %s<br>\n", $this->Error);
- die("Session halted.");
}
+
}
?>
Index: php-lib/php/db_mysql.inc
diff -u php-lib/php/db_mysql.inc:1.24 php-lib/php/db_mysql.inc:1.25
--- php-lib/php/db_mysql.inc:1.24 Wed Oct 27 15:17:34 1999
+++ php-lib/php/db_mysql.inc Thu Nov 11 21:41:46 1999
@@ -5,7 +5,7 @@
* Copyright (c) 1998,1999 NetUSE GmbH
* Boris Erdmann, Kristian Koehntopp
*
- * $Id: db_mysql.inc,v 1.24 1999/10/27 13:17:34 kk Exp $
+ * $Id: db_mysql.inc,v 1.25 1999/11/11 20:41:46 kk Exp $
*
*/
@@ -77,7 +77,7 @@
}
if (! <email protected>($Database,$this->Link_ID)) {
- $this->halt("cannot use database ".$this->Database);
+ $this->halt("cannot use database ".$Database);
return 0;
}
}
@@ -150,14 +150,14 @@
if ($status)
$this->Row = $pos;
else {
- $this->halt("seek($pos) failed: result has ".$this->num_rows()." rows");
+ $this->halt("seek($pos) failed: result has ".$this->num_rows()." rows.");
/* half assed attempt to save the day,
* but do not consider this documented or even
* desireable behaviour.
*/
<email protected>($this->Query_ID, $this->num_rows());
- $this->Row = $this->num_rows;
+ $this->Row = $this->num_rows();
return 0;
}
@@ -200,7 +200,6 @@
return $res;
}
-
/* public: evaluate the result (size, width) */
function affected_rows() {
return <email protected>($this->Link_ID);
@@ -269,7 +268,7 @@
}
/* public: return table metadata */
- function metadata($table='',$full=false) {
+ function metadata($table = "", $full = false) {
$count = 0;
$id = 0;
$res = array();
@@ -297,7 +296,6 @@
* [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'])) { ...
*/
// if no $table specified, assume that we are working with a query
@@ -305,12 +303,16 @@
if ($table) {
$this->connect();
$id = <email protected>($this->Database, $table);
- if (!$id)
+ if (!$id) {
$this->halt("Metadata query failed.");
+ return false;
+ }
} else {
$id = $this->Query_ID;
- if (!$id)
+ if (!$id) {
$this->halt("No query specified.");
+ return false;
+ }
}
$count = <email protected>($id);
@@ -338,10 +340,27 @@
}
// free the result only if we were called on a table
- if ($table) <email protected>($id);
+ if ($table)
+ <email protected>($id);
return $res;
}
+ /* public: find available table names */
+ function table_names() {
+ $this->connect();
+ $h = <email protected>("show tables", $this->Link_ID);
+ $i = 0;
+ while ($info = <email protected>($this->Query_ID)) {
+ $return[$i]["table_name"]= $info[0];
+ $return[$i]["tablespace_name"]=$this->Database;
+ $return[$i]["database"]=$this->Database;
+ $i++;
+ }
+
+ <email protected>($h);
+ return $return;
+ }
+
/* private: error handling */
function halt($msg) {
$this->Error = <email protected>($this->Link_ID);
@@ -362,17 +381,5 @@
$this->Error);
}
- 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;
- }
}
?>
Index: php-lib/php/db_mssql.inc
diff -u php-lib/php/db_mssql.inc:1.2 php-lib/php/db_mssql.inc:1.3
--- php-lib/php/db_mssql.inc:1.2 Sun Oct 24 14:15:21 1999
+++ php-lib/php/db_mssql.inc Thu Nov 11 21:41:46 1999
@@ -4,119 +4,178 @@
*
* (C) Copyright 1998 Cameron Taggart (cameront <email protected>)
* Modified by Guarneri carmelo (carmelo <email protected>)
- * Modified by Cameron Just (C.Just <email protected>)
+ * Modified by Cameron Just (C.Just <email protected>)
*
- * $Id: db_mssql.inc,v 1.2 1999/10/24 12:15:21 kk Exp $
+ * $Id: db_mssql.inc,v 1.3 1999/11/11 20:41:46 kk Exp $
*/
-# echo "<BR>This is using the MSSQL class<BR>";
class DB_Sql {
+
+ /* public: connection parameters */
var $Host = "";
var $Database = "";
var $User = "";
var $Password = "";
- var $Link_ID = 0;
- var $Query_ID = 0;
+ /* public configuration parameters */
+ var $Auto_Free = 0; ## set this to 1 to automatically free results.
+ var $Debug = 0; ## set this to 1 for debug output.
+ var $Halt_On_Error = "yes";
+
+ /* public: result array and current row number */
var $Record = array();
var $Row = 0;
-
+
+ /* public: current error number and error text */
var $Errno = 0;
var $Error = "";
- var $Auto_Free = 0; ## set this to 1 to automatically free results
-
+ /* public: this is an api revision, not a CVS revision. */
+ var $type = "mssql";
+ var $revision = "1.2";
- function connect() {
+ /* private: link and query handles */
+ var $Link_ID = 0;
+ var $Query_ID = 0;
+
+
+ /* public: constructor */
+ function DB_Sql($query = "") {
+ $this->query($query);
+ }
+
+ /* public: some trivial reporting */
+ function link_id() {
+ return $this->Link_ID;
+ }
+
+ function query_id() {
+ return $this->Query_ID;
+ }
+
+ /* public: connection management */
+ function connect($Database = "", $Host = "", $User = "", $Password = "") {
+ /* Handle defaults */
+ if ("" == $Database)
+ $Database = $this->Database;
+ if ("" == $Host)
+ $Host = $this->Host;
+ if ("" == $User)
+ $User = $this->User;
+ if ("" == $Password)
+ $Password = $this->Password;
+
+ /* establish connection, select database */
if ( 0 == $this->Link_ID ) {
- $this->Link_ID=mssql_pconnect($this->Host, $this->User, $this->Password);
- if (!$this->Link_ID)
- $this->halt("Link-ID == false, mssql_pconnect failed");
- else
- mssql_select_db($this->Database, $this->Link_ID);
+
+ $this->Link_ID=mssql_pconnect($Host, $User, $Password);
+ if (!$this->Link_ID) {
+ $this->halt("pconnect($Host, $User, \$Password) failed.");
+ return 0;
+ }
+
+ if (! <email protected>($Database, $Link_ID)) {
+ $this->halt("cannot select database $Database");
+ return 0;
+ }
}
+
+ return $this->Link_ID;
}
- function free_result(){
- mssql_free_result($this->Query_ID);
- $this->Query_ID = 0;
+
+ /* public: discard the query result */
+ function free() {
+ <email protected>($this->Query_ID);
+ $this->Query_ID = 0;
}
-
+
+ /* public: perform a query */
function query($Query_String) {
- if (!$this->Link_ID)
- $this->connect();
+ /* No empty queries, please! */
+ if ($Query_String == "")
+ return 0;
-# printf("<br>Debug: query = %s<br>\n", $Query_String);
+ if (!$this->connect())
+ return 0; /* we already complained in connect() about that. */
+
+ /* discard old result */
+ if ($this->Query_ID)
+ $this->free();
+
+ if ($this->Debug)
+ printf("Debug: query = %s<br>\n", $Query_String);
- $this->Query_ID = mssql_query($Query_String, $this->Link_ID);
+ $this->Query_ID = <email protected>($Query_String, $this->Link_ID);
$this->Row = 0;
if (!$this->Query_ID) {
- $this->Errno = 1;
- $this->Error = "General Error (The MSSQL interface cannot return detailed error messages).";
$this->halt("Invalid SQL: ".$Query_String);
}
+
+ /* will return false, if query fails. This is just what we wanted. */
return $this->Query_ID;
}
+ /* public: walk result set */
function next_record() {
-
+ if (!$this->Query_ID) {
+ $this->halt("next_record called with no query pending.");
+ return 0;
+ }
+
if ($this->Record = mssql_fetch_row($this->Query_ID)) {
// add to Record[<key>]
$count = mssql_num_fields($this->Query_ID);
for ($i=0; $i<$count; $i++){
- $fieldinfo = mssql_fetch_field($this->Query_ID,$i);
+ $fieldinfo = mssql_fetch_field($this->Query_ID,$i);
$this->Record[strtolower($fieldinfo->name)] = $this->Record[$i];
}
$this->Row += 1;
$stat = 1;
} else {
- if ($this->Auto_Free) {
- $this->free_result();
- }
+ if ($this->Auto_Free)
+ $this->free();
$stat = 0;
}
return $stat;
}
-
- function seek($pos) {
- mssql_data_seek($this->Query_ID,$pos);
- $this->Row = $pos;
- }
-
- function metadata($table) {
- $count = 0;
- $id = 0;
- $res = array();
- $this->connect();
- $id = mssql_query("select * from $table", $this->Link_ID);
- if (!$id) {
- $this->Errno = 1;
- $this->Error = "General Error (The MSSQL interface cannot return detailed error messages).";
- $this->halt("Metadata query failed.");
- }
- $count = mssql_num_fields($id);
-
- for ($i=0; $i<$count; $i++) {
- $info = mssql_fetch_field($id, $i);
- $res[$i]["table"] = $table;
- $res[$i]["name"] = $info["name"];
- $res[$i]["len"] = $info["max_length"];
- $res[$i]["flags"] = $info["numeric"];
+ /* public: position in result set */
+ function seek($pos = 0) {
+ $status = <email protected>($this->Query_ID,$pos);
+ if ($status)
+ $this->Row = $pos;
+ else {
+ $this->halt("seek($pos) failed: result has ".$this->num_rows()." rows.");
+
+ /* trying to save the day */
+ <email protected>($this->Query_ID, $this->num_rows());
+ $this->Row = $this->num_rows();
+ return 0;
}
- $this->free_result();
- return $res;
+
+ return 1;
}
+ /* public: table locking */
+ function lock($table, $mode="write") {
+ $this->halt("How would you lock a table in mssql?");
+ }
+
+ function unlock() {
+ $this->halt("How would you unlock a table in mssql?");
+ }
+
+ /* public: evaluate the result (size, width) */
function affected_rows() {
- return mssql_affected_rows($this->Query_ID);
+ return <email protected>($this->Query_ID);
}
function num_rows() {
- return mssql_num_rows($this->Query_ID);
+ return <email protected>($this->Query_ID);
}
function num_fields() {
- return mssql_num_fields($this->Query_ID);
+ return <email protected>($this->Query_ID);
}
function nf() {
@@ -134,13 +193,85 @@
function p($Field_Name) {
print $this->f($Field_Name);
}
+
+ /* public: sequence numbers */
+ function nextid($seq_name) {
+ $this->halt("This function has not been implemented. Do you know how to do it?");
+ return false;
+ }
+ /* public: return table metadata */
+ function metadata($table = "", $full = false) {
+ $count = 0;
+ $id = 0;
+ $res = array();
+
+ if ($table) {
+ $this->connect();
+ $id = <email protected>("select * from $table", $this->Link_ID);
+ if (!$id) {
+ $this->halt("Metadata query failed.");
+ return false;
+ }
+ } else {
+ $id = $this->Query_ID;
+ if (!$id) {
+ $this->halt("No query specified.");
+ return false;
+ }
+ }
+
+ $count = <email protected>($id);
+
+ if (!$full) {
+ for ($i=0; $i<$count; $i++) {
+ $info = mssql_fetch_field($id, $i);
+ $res[$i]["table"] = $table;
+ $res[$i]["name"] = $info["name"];
+ $res[$i]["len"] = $info["max_length"];
+ $res[$i]["flags"] = $info["numeric"];
+ }
+ } else {
+ $res["num_fields"] = $count;
+ for ($i=0; $i<$count; $i++) {
+ $info = mssql_fetch_field($id, $i);
+ $res[$i]["table"] = $table;
+ $res[$i]["name"] = $info["name"];
+ $res[$i]["len"] = $info["max_length"];
+ $res[$i]["flags"] = $info["numeric"];
+ $res["meta"][$res[$i]["name"]] = $i;
+ }
+ }
+ if ($table)
+ <email protected>($id);
+
+ return $res;
+ }
+
+ /* public: find available table names */
+ function table_names() {
+ $this->halt("To be modelled after the table_names() function in db_mysqlinc");
+ return false;
+ }
+
+ /* private: error handling. */
function halt($msg) {
+ $this->Errno = 1;
+ $this->Error = "The MSSql interface lacks proper error reporting.";
+ if ($this->Halt_On_Error == "no")
+ return;
+
+ $this->haltmsg($msg);
+
+ if ($this->Halt_On_Error != "report")
+ die("Session halted.");
+ }
+
+ function haltmsg($msg) {
printf("</td></tr></table><b>Database error:</b> %s<br>\n", $msg);
printf("<b>MSSQL Error</b>: %s (%s)<br>\n",
$this->Errno,
$this->Error);
- die("Session halted.");
}
}
?>
-
PHPLIB Developers Mailing List. Send messages to <phplib-dev <email protected>>.
To unsubscribe, send "unsubscribe" to <phplib-dev-request <email protected>> in
the body, not the subject, of your message.
- Next message: kk: "[PHPLIB-DEV] cvs commit"
- Previous message: athompso: "[PHPLIB-DEV] cvs commit"
- Next in thread: kk: "[PHPLIB-DEV] cvs commit"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

