[phpMP-CVS] CVS: phpMP/dba mssql.dba,NONE,1.1
Status: Pre-Alpha
Brought to you by:
heimidal
From: Anthony W. <ant...@us...> - 2003-02-15 00:35:27
|
Update of /cvsroot/phpmp/phpMP/dba In directory sc8-pr-cvs1:/tmp/cvs-serv25888/dba Added Files: mssql.dba Log Message: Database Access file for Microsoft SQL databases --- NEW FILE: mssql.dba --- <?php class DB { var $ident_link; var $connected; function connect() { if (empty($this->ident_link)) { $connection = @mssql_connect(DB_HOST, DB_USER, DB_PASSWD); if (!$connection) { $this->connected = 0; return 0; } else { $this->ident_link = $connection; return $this->ident_link; } } } function close() { if ($this->ident_link != 0) { @mssql_close($this->ident_link); $this->ident_link = 0; return 1; } else { return 1; } } function query($qry) { if ($this->ident_link == 0) { $db = $this->connect(); } else { $db = $this->ident_link; } if (!$db) { return 0; } else { $result = @mssql_query($qry, $db); return $result; } } function numRows($qry) { if ($this->ident_link == 0) { $db = $this->connect(); } else { $db = $this->ident_link; } if (!$db) { return 0; } else { $num = @mssql_num_rows($qry); return $num; } } function result($result, $row=0, $field='') { if ($this->ident_link == 0) { $db = $this->connect(); } else { $db = $this->ident_link; } if (!$db) { return 0; } else { $return = @mssql_result($result, $row, $field); return $return; } } function fetchArray($qry) { if ($this->ident_link == 0) { $db = $this->connect(); } else { $db = $this->ident_link; } if (!$db) { return 0; } else { $result = @mssql_fetch_array($qry); return $result; } } function fetchRow($qry) { if ($this->ident_link == 0) { $db = $this->connect(); } else { $db = $this->ident_link; } if (!$db) { return 0; } else { $result = @mssql_fetch_row($qry) return $result; } } function escapeString($string) { if( stripslashes($string) == $string ) // Will be true if no slashes were removed. { addslashes($string); // We'll add the slashes because they haven't already been added. return true; } else // Slashes have already been added (hopefully only once). { return true; } } } ?> |