From 12d850e0b8e321b96a037e932cc5080b73b8f58e Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Tue, 28 Feb 2012 14:59:10 -0500 Subject: [PATCH] Removed source folder --- src/common/db_pdo.php | 216 ------------------------------------------ 1 file changed, 216 deletions(-) delete mode 100644 src/common/db_pdo.php diff --git a/src/common/db_pdo.php b/src/common/db_pdo.php deleted file mode 100644 index 100c505..0000000 --- a/src/common/db_pdo.php +++ /dev/null @@ -1,216 +0,0 @@ -prepare($sql); - - if( ! (is_object($query) || is_resource($query))) - { - $this->get_last_error(); - return FALSE; - } - - // Set the statement in the class variable for easy later access - $this->statement =& $query; - - - if( ! (is_array($data) || is_object($data))) - { - trigger_error("Invalid data argument"); - return FALSE; - } - - // Bind the parameters - foreach($data as $k => $value) - { - if(is_numeric($k)) - { - $k++; - } - - $res = $query->bindValue($k, $value); - - if( ! $res) - { - trigger_error("Parameter not successfully bound"); - return FALSE; - } - } - - return $query; - - } - - /** - * Create and execute a prepared statement with the provided parameters - * - * @param string $sql - * @param array $params - * @return PDOStatement - */ - public function prepare_execute($sql, $params) - { - $this->statement =& $this->prepare_query($sql, $params); - $this->statement->execute(); - - return $this->statement; - } - - // ------------------------------------------------------------------------- - - /** - * Retreives the data from a select query - * - * @param PDOStatement $statement - * @return array - */ - public function get_query_data($statement) - { - $this->statement = $statement; - - // Execute the query - $this->statement->execute(); - - // Return the data array fetched - return $this->statement->fetchAll(PDO::FETCH_ASSOC); - } - - // ------------------------------------------------------------------------- - - /** - * Returns number of rows affected by an INSERT, UPDATE, DELETE type query - * - * @param PDOStatement $statement - * @return int - */ - public function affected_rows($statement) - { - $this->statement = $statement; - - // Execute the query - $this->statement->execute(); - - // Return number of rows affected - return $this->statement->rowCount; - } - - // -------------------------------------------------------------------------- - - /** - * Return the last error for the current database connection - * - * @return string - */ - public function get_last_error() - { - $info = $this->errorInfo(); - - echo "Error:
{$info[0]}:{$info[1]}\n{$info[2]}
"; - } - - // ------------------------------------------------------------------------- - - /** - * Abstract public functions to override in child classes - */ - - /** - * Return list of tables for the current database - * - * @return array - */ - abstract public function get_tables(); - - /** - * Empty the passed table - * - * @param string $table - * - * @return void - */ - abstract public function truncate($table); - - /** - * Return the number of rows for the last SELECT query - * - * @return int - */ - abstract public function num_rows(); - - /** - * Retreives an array of non-user-created tables for - * the connection/database - * - * @return array - */ - abstract public function get_system_tables(); - -} - -// ------------------------------------------------------------------------- - -/** - * Abstract parent for database manipulation subclasses - */ -abstract class db_manip { - - /** - * Get database-specific sql to create a new table - * - * @param string $name - * @param array $columns - * @param array $constraints - * @param array $indexes - * - * @return string - */ - abstract public function create_table($name, $columns, $constraints=array(), $indexes=array()); - - /** - * Get database-specific sql to drop a table - * - * @param string $name - * - * @return string - */ - abstract public function delete_table($name); -} -// End of db_pdo.php \ No newline at end of file