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

3
.gitignore vendored
View File

@ -2,5 +2,4 @@
*.DS_Store
settings.json
errors.txt
*/simpletest/*
*/simpletest/*

View File

@ -111,8 +111,36 @@ abstract class DB_PDO extends PDO {
/**
* Abstract functions to override in child classes
*/
/**
* Return list of tables for the current database
*
* @return array
*/
abstract function get_tables();
/**
* Empty the passed table
*
* @param string $table
*
* @return void
*/
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

View File

@ -86,6 +86,17 @@ class firebird {
//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
*
@ -96,6 +107,26 @@ class firebird {
$sql="SELECT rdb\$relation_name FROM rdb\$relations WHERE rdb\$relation_name NOT LIKE 'RDB\$%'";
$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
}
}

View File

@ -69,6 +69,26 @@ class MySQL extends DB_PDO {
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 {

View File

@ -48,6 +48,26 @@ class ODBC extends DB_PDO {
$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

View File

@ -93,6 +93,26 @@ class pgSQL extends DB_PDO {
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()
{
//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
}
}