Source for file PMO_Dbms_Mysql.php
Documentation is available at PMO_Dbms_Mysql.php
* This file contains the PMO_Dbms_Mysql driver class.
* This file is part of the PhpMyObject project,
* an Object-Relational Mapping (ORM) system.
* For questions, help, comments, discussion, etc., please join our
* forum at {@link http://www.developpez.net/forums/forumdisplay.php?f=770}
* or our mailing list at {@link http://groups.google.com/group/pmo-dev}.
* PhpMyObject is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see {@link http://www.gnu.org/licenses/}.
* @author Nicolas Boiteux <nicolas_boiteux@yahoo.fr>
* @link http://pmo.developpez.com/
* @since PhpMyObject v0.1
* @copyright Copyright (C) 2007-2008 Nicolas Boiteux
* @license GPLv3 {@link http://www.gnu.org/licenses/gpl}
* This class implements the MySql driver.
* a result resource returned by a MySql query
* if a mysql link is provided, it will be used.
* @param resource $mysqllink a standrd MySql link returned by mysql_query()
$this->setDB($mysqllink);
* establishes a connection with the database server and the database
* @param array $authdb the database connection information, e.g. host,
* user name and password, database name
* @throws Exception if we cannot connect to the database server or
public function connect(array $authdb){
$this->setDB(mysql_connect($authdb['host'], $authdb['user'], $authdb['pass']));
throw new Exception(mysql_error());
if(!mysql_select_db($authdb['base'], $this->getDB()))
throw new Exception(mysql_error());
* closes the database connetion
* execute a SQL query against the database
* @param string $query the SQL query to execute against the database
* @return bool TRUE is the query returned some results
* @throws Exception if no result were returned by the query
public function query($query){
* returns the next row as an associative array
* returns an array containing the table properties
* @param string $table the table name to look for
$tmparray[] = array("Field"=> $dbresult['Field'],
"Null" => $dbresult['Null'],
"Default"=> $dbresult['Default'],
"Extra"=> $dbresult['Extra'],
* returns the last inserted id
* starts a MySql transaction
* @todo need to check if we already are in an open transaction
* and throw an exception if so
* rolls back a transaction
* @todo need to check if we are in a transaction and throw
* an exception if we are not
* @todo need to check if we are in a transaction and throw
* an exception if we are not
|