More DB driver updateds

This commit is contained in:
Timothy Warren 2012-02-06 16:56:16 -05:00
parent 6c20b88f95
commit 7600e5634e
7 changed files with 142 additions and 3 deletions

1
.gitignore vendored
View File

@ -3,4 +3,3 @@
settings.json settings.json
errors.txt errors.txt
*/simpletest/* */simpletest/*

View File

@ -111,8 +111,36 @@ abstract class DB_PDO extends PDO {
/** /**
* Abstract functions to override in child classes * Abstract functions to override in child classes
*/ */
/**
* Return list of tables for the current database
*
* @return array
*/
abstract function get_tables(); abstract function get_tables();
/**
* Empty the passed table
*
* @param string $table
*
* @return void
*/
abstract function truncate($table); abstract function truncate($table);
/**
* Return the number of rows for the last SELECT query
*
* @return int
*/
abstract function num_rows();
/**
* Return the number of rows affected by the last query
*
* @return int
*/
abstract function affected_rows();
} }
// End of db_pdo.php // End of db_pdo.php

View File

@ -86,6 +86,17 @@ class firebird {
//TODO implement //TODO implement
} }
/**
* Emulate PDO prepare
*
* @return resource
*/
function prepare()
{
$this->statement = ibase_prepare($this->conn, $query);
return $this->statement;
}
/** /**
* List tables for the current database * List tables for the current database
* *
@ -97,6 +108,26 @@ class firebird {
$res = $this->query($sql); $res = $this->query($sql);
} }
/**
* Return the number of rows affected by the previous query
*
* @return int
*/
function affected_rows()
{
// TODO: Implement
}
/**
* Return the number of rows returned for a SELECT query
*
* @return int
*/
function num_rows()
{
// TODO: Implement
}
} }
class firebird_manip extends firebird { class firebird_manip extends firebird {

View File

@ -69,6 +69,26 @@ class MySQL extends DB_PDO {
return $res->fetchAll(PDO::FETCH_ASSOC); return $res->fetchAll(PDO::FETCH_ASSOC);
} }
/**
* Return the number of rows affected by the previous query
*
* @return int
*/
function affected_rows()
{
// TODO: Implement
}
/**
* Return the number of rows returned for a SELECT query
*
* @return int
*/
function num_rows()
{
// TODO: Implement
}
} }
class MySQL_manip extends MySQL { class MySQL_manip extends MySQL {

View File

@ -48,6 +48,26 @@ class ODBC extends DB_PDO {
$this->query($sql); $this->query($sql);
} }
/**
* Return the number of rows affected by the previous query
*
* @return int
*/
function affected_rows()
{
// TODO: Implement
}
/**
* Return the number of rows returned for a SELECT query
*
* @return int
*/
function num_rows()
{
// TODO: Implement
}
} }
// End of odbc.php // End of odbc.php

View File

@ -93,6 +93,26 @@ class pgSQL extends DB_PDO {
return $views; return $views;
} }
/**
* Return the number of rows affected by the previous query
*
* @return int
*/
function affected_rows()
{
// TODO: Implement
}
/**
* Return the number of rows returned for a SELECT query
*
* @return int
*/
function num_rows()
{
// TODO: Implement
}
} }
/** /**

View File

@ -50,7 +50,28 @@ class SQLite extends DB_PDO {
*/ */
function get_tables() function get_tables()
{ {
//TODO: implement $res = $this->query("SELECT name FROM sqlite_master WHERE type='table'");
return $res->fetchAll(PDO::FETCH_ASSOC);
}
/**
* Return the number of rows affected by the previous query
*
* @return int
*/
function affected_rows()
{
// TODO: Implement
}
/**
* Return the number of rows returned for a SELECT query
*
* @return int
*/
function num_rows()
{
// TODO: Implement
} }
} }