From 3493e89d1c8be05362ac87460e9bd69c7fb13fc1 Mon Sep 17 00:00:00 2001 From: Timothy Warren Date: Tue, 21 Feb 2012 11:45:42 -0500 Subject: [PATCH] Added visibility keywords --- src/common/db_pdo.php | 22 +++++++++---------- src/common/settings.php | 14 ++++++------- src/databases/firebird.php | 36 ++++++++++++++++---------------- src/databases/firebird_manip.php | 8 +++---- src/databases/mysql.php | 12 +++++------ src/databases/mysql_manip.php | 8 +++---- src/databases/odbc.php | 10 ++++----- src/databases/pgsql.php | 16 +++++++------- src/databases/pgsql_manip.php | 4 ++-- src/databases/sqlite.php | 14 ++++++------- src/databases/sqlite_manip.php | 12 +++++------ src/windows/add_db.php | 6 +++--- src/windows/main.php | 10 ++++----- 13 files changed, 85 insertions(+), 87 deletions(-) diff --git a/src/common/db_pdo.php b/src/common/db_pdo.php index 58d1ef4..f994c36 100644 --- a/src/common/db_pdo.php +++ b/src/common/db_pdo.php @@ -23,7 +23,7 @@ abstract class DB_PDO extends PDO { protected $statement; - function __construct($dsn, $username=NULL, $password=NULL, $driver_options=array()) + public function __construct($dsn, $username=NULL, $password=NULL, $driver_options=array()) { parent::__construct($dsn, $username, $password, $driver_options); } @@ -37,7 +37,7 @@ abstract class DB_PDO extends PDO { * @param array $data * @return mixed PDOStatement / FALSE */ - function prepare_query($sql, $data) + public function prepare_query($sql, $data) { // Prepare the sql $query = $this->prepare($sql); @@ -82,7 +82,7 @@ abstract class DB_PDO extends PDO { * @param PDOStatement $statement * @return array */ - function get_query_data($statement) + public function get_query_data($statement) { $this->statement = $statement; @@ -101,7 +101,7 @@ abstract class DB_PDO extends PDO { * @param PDOStatement $statement * @return int */ - function affected_rows($statement) + public function affected_rows($statement) { $this->statement = $statement; @@ -115,7 +115,7 @@ abstract class DB_PDO extends PDO { // ------------------------------------------------------------------------- /** - * Abstract functions to override in child classes + * Abstract public functions to override in child classes */ /** @@ -123,7 +123,7 @@ abstract class DB_PDO extends PDO { * * @return array */ - abstract function get_tables(); + abstract public function get_tables(); /** * Empty the passed table @@ -132,14 +132,14 @@ abstract class DB_PDO extends PDO { * * @return void */ - abstract function truncate($table); + abstract public function truncate($table); /** * Return the number of rows for the last SELECT query * * @return int */ - abstract function num_rows(); + abstract public function num_rows(); /** * Retreives an array of non-user-created tables for @@ -147,7 +147,7 @@ abstract class DB_PDO extends PDO { * * @return array */ - abstract function get_system_tables(); + abstract public function get_system_tables(); } @@ -168,7 +168,7 @@ abstract class db_manip { * * @return string */ - abstract function create_table($name, $columns, $constraints=array(), $indexes=array()); + abstract public function create_table($name, $columns, $constraints=array(), $indexes=array()); /** * Get database-specific sql to drop a table @@ -177,6 +177,6 @@ abstract class db_manip { * * @return string */ - abstract function delete_table($name); + abstract public function delete_table($name); } // End of db_pdo.php \ No newline at end of file diff --git a/src/common/settings.php b/src/common/settings.php index 6ff977a..df5d6f7 100644 --- a/src/common/settings.php +++ b/src/common/settings.php @@ -24,7 +24,7 @@ class Settings { /** * Load the settings file */ - function __construct() + public function __construct() { $path = BASE_DIR.'/settings.json'; @@ -52,7 +52,7 @@ class Settings { /** * Save the settings file on close, just to be safe */ - function __destruct() + public function __destruct() { file_put_contents(BASE_DIR.'/settings.json', json_encode($this->current)); } @@ -65,7 +65,7 @@ class Settings { * @param string $key * @return $mixed */ - function __get($key) + public function __get($key) { return (isset($this->current->{$key})) ? $this->current->{$key} : NULL; } @@ -78,7 +78,7 @@ class Settings { * @param string $key * @param mixed $val */ - function __set($key, $val) + public function __set($key, $val) { //Don't allow direct db config changes if($key == "dbs") @@ -97,7 +97,7 @@ class Settings { * @param string $name * @param array $params */ - function add_db($name, $params) + public function add_db($name, $params) { if( ! isset($this->current->dbs->{$name})) { @@ -117,7 +117,7 @@ class Settings { * * @param string $name */ - function remove_db($name) + public function remove_db($name) { if( ! isset($this->current->dbs->{$name})) { @@ -135,7 +135,7 @@ class Settings { * * @return array */ - function get_dbs() + public function get_dbs() { return $this->current->dbs; } diff --git a/src/databases/firebird.php b/src/databases/firebird.php index 92b18a7..3ef38be 100644 --- a/src/databases/firebird.php +++ b/src/databases/firebird.php @@ -15,7 +15,7 @@ /** * Firebird Database class * - * PDO-firebird isn't stable, so this is a wrapper of the ibase_ functions. + * PDO-firebird isn't stable, so this is a wrapper of the ibase_ public functions. */ class firebird { @@ -29,7 +29,7 @@ class firebird { * @param string $user * @param string $pass */ - function __construct($dbpath, $user="sysdba", $pass="masterkey") + public function __construct($dbpath, $user="sysdba", $pass="masterkey") { $this->conn = ibase_connect($dbpath, $user, $pass); @@ -40,7 +40,7 @@ class firebird { /** * Close the link to the database */ - function __destruct() + public function __destruct() { @ibase_close($this->conn); @ibase_free_result($this->statement); @@ -51,7 +51,7 @@ class firebird { * * @param string $table */ - function truncate($table) + public function truncate($table) { // Firebird lacka a truncate command $sql = 'DELETE FROM '.$table.'"'; @@ -59,24 +59,24 @@ class firebird { } /** - * Wrapper function to better match PDO + * Wrapper public function to better match PDO * * @param string $sql * @return resource */ - function query($sql) + public function query($sql) { $this->statement = ibase_query($this->conn, $sql); return $this->statement; } /** - * Emulate PDO fetch function + * Emulate PDO fetch public function * * @param int $fetch_style * @return mixed */ - function fetch($fetch_style=PDO::FETCH_ASSOC) + public function fetch($fetch_style=PDO::FETCH_ASSOC) { switch($fetch_style) { @@ -102,12 +102,12 @@ class firebird { } /** - * Emulate PDO fetchAll function + * Emulate PDO fetchAll public function * * @param int $fetch_style * @return mixed */ - function fetchAll($fetch_style=PDO::FETCH_ASSOC) + public function fetchAll($fetch_style=PDO::FETCH_ASSOC) { $all = array(); @@ -124,7 +124,7 @@ class firebird { * * @return resource */ - function prepare() + public function prepare() { $this->statement = ibase_prepare($this->conn, $query); return $this->statement; @@ -135,7 +135,7 @@ class firebird { * * @return array */ - function get_tables() + public function get_tables() { $sql = <<conn); } @@ -195,7 +195,7 @@ SQL; * * @return int */ - function num_rows() + public function num_rows() { $count = 0; @@ -219,7 +219,7 @@ SQL; * * @return resource */ - function beginTransaction() + public function beginTransaction() { if($this->trans = ibase_trans($this->conn) !== null) { @@ -234,7 +234,7 @@ SQL; * * @return bool */ - function commit() + public function commit() { return ibase_commit($this->trans); } @@ -244,7 +244,7 @@ SQL; * * @return bool */ - function rollBack() + public function rollBack() { return ibase_rollback($this->trans); } diff --git a/src/databases/firebird_manip.php b/src/databases/firebird_manip.php index 8b64f24..e53b7d4 100644 --- a/src/databases/firebird_manip.php +++ b/src/databases/firebird_manip.php @@ -15,12 +15,12 @@ /** * Firebird Database Manipulation class * - * PDO-firebird isn't stable, so this is a wrapper of the ibase_ functions. + * PDO-firebird isn't stable, so this is a wrapper of the ibase_ public functions. */ class firebird_manip extends db_manip{ /** - * Convienience function to generate sql for creating a db table + * Convienience public function to generate sql for creating a db table * * @param string $name * @param array $fields @@ -29,7 +29,7 @@ class firebird_manip extends db_manip{ * * @return string */ - function create_table($name, $fields, $constraints=array(), $indexes=array()) + public function create_table($name, $fields, $constraints=array(), $indexes=array()) { $column_array = array(); @@ -83,7 +83,7 @@ class firebird_manip extends db_manip{ * @param string $name * @return string */ - function delete_table($name) + public function delete_table($name) { return 'DROP TABLE "'.$name.'"'; } diff --git a/src/databases/mysql.php b/src/databases/mysql.php index c1e555f..6b84570 100644 --- a/src/databases/mysql.php +++ b/src/databases/mysql.php @@ -27,7 +27,7 @@ class MySQL extends DB_PDO { * @param string $password=null * @param array $options=array() */ - function __construct($dsn, $username=null, $password=null, $options=array()) + public function __construct($dsn, $username=null, $password=null, $options=array()) { $options = array_merge(array( PDO::MYSQL_ATTR_FOUND_ROWS => true @@ -45,7 +45,7 @@ class MySQL extends DB_PDO { * * @param string $table */ - function truncate($table) + public function truncate($table) { $this->query("TRUNCATE `{$table}`"); } @@ -55,7 +55,7 @@ class MySQL extends DB_PDO { * * @return array */ - function get_dbs() + public function get_dbs() { $res = $this->query("SHOW DATABASES"); return $this->fetchAll(PDO::FETCH_ASSOC); @@ -66,7 +66,7 @@ class MySQL extends DB_PDO { * * @return array */ - function get_tables() + public function get_tables() { $res = $this->query("SHOW TABLES"); return $res->fetchAll(PDO::FETCH_ASSOC); @@ -77,7 +77,7 @@ class MySQL extends DB_PDO { * * @return array */ - function get_system_tables() + public function get_system_tables() { //MySQL doesn't have system tables return array(); @@ -88,7 +88,7 @@ class MySQL extends DB_PDO { * * @return int */ - function num_rows() + public function num_rows() { return isset($this->statement) ? $this->statement->rowCount() : FALSE; } diff --git a/src/databases/mysql_manip.php b/src/databases/mysql_manip.php index 58b77d7..eef6e0c 100644 --- a/src/databases/mysql_manip.php +++ b/src/databases/mysql_manip.php @@ -18,7 +18,7 @@ class MySQL_manip extends db_manip{ /** - * Convienience function for creating a new MySQL table + * Convienience public function for creating a new MySQL table * * @param [type] $name [description] * @param [type] $columns [description] @@ -27,18 +27,18 @@ * * @return [type] */ - function create_table($name, $columns, $constraints=array(), $indexes=array()) + public function create_table($name, $columns, $constraints=array(), $indexes=array()) { //TODO: implement } /** - * Convience function for droping a MySQL table + * Convience public function for droping a MySQL table * * @param string $name * @return string */ - function delete_table($name) + public function delete_table($name) { return <<query($sql); @@ -67,7 +67,7 @@ class ODBC extends DB_PDO { * * @return int */ - function num_rows() + public function num_rows() { // TODO: Implement } diff --git a/src/databases/pgsql.php b/src/databases/pgsql.php index bbf40ba..ec2b96f 100644 --- a/src/databases/pgsql.php +++ b/src/databases/pgsql.php @@ -27,7 +27,7 @@ class pgSQL extends DB_PDO { * @param string $password=null * @param array $options=array() */ - function __construct($dsn, $username=null, $password=null, $options=array()) + public function __construct($dsn, $username=null, $password=null, $options=array()) { parent::__construct("pgsql:$dsn", $username, $password, $options); @@ -41,7 +41,7 @@ class pgSQL extends DB_PDO { * * @param string $table */ - function truncate($table) + public function truncate($table) { $sql = 'TRUNCATE "' . $table . '"'; $this->query($sql); @@ -52,7 +52,7 @@ class pgSQL extends DB_PDO { * * @return array */ - function get_dbs() + public function get_dbs() { $sql = <<statement)) ? $this->statement->rowCount : FALSE; } diff --git a/src/databases/pgsql_manip.php b/src/databases/pgsql_manip.php index a683892..8f689b4 100644 --- a/src/databases/pgsql_manip.php +++ b/src/databases/pgsql_manip.php @@ -19,12 +19,12 @@ */ class pgSQL_manip extends db_manip { - function create_table($name, $columns, $constraints=array(), $indexes=array()) + public function create_table($name, $columns, $constraints=array(), $indexes=array()) { //TODO: implement } - function delete_table($name) + public function delete_table($name) { return <<statement)) ? $this->statment->rowCount : FALSE; } diff --git a/src/databases/sqlite_manip.php b/src/databases/sqlite_manip.php index 6f54e35..f1528f0 100644 --- a/src/databases/sqlite_manip.php +++ b/src/databases/sqlite_manip.php @@ -18,7 +18,7 @@ class SQLite_manip extends db_manip { /** - * Convenience function to create a new table + * Convenience public function to create a new table * * @param string $name //Name of the table * @param array $columns //columns as straight array and/or column => type pairs @@ -26,7 +26,7 @@ class SQLite_manip extends db_manip { * @param array $indexes // column => index pairs * @return string */ - function create_table($name, $columns, $constraints=array(), $indexes=array()) + public function create_table($name, $columns, $constraints=array(), $indexes=array()) { $column_array = array(); @@ -80,11 +80,9 @@ class SQLite_manip extends db_manip { * @param string $name * @return string */ - function delete_table($name) + public function delete_table($name) { - return << $this->dbtype->get_active_text(), diff --git a/src/windows/main.php b/src/windows/main.php index a63304b..95c3649 100644 --- a/src/windows/main.php +++ b/src/windows/main.php @@ -24,7 +24,7 @@ class Main extends GtkWindow { /** * Create and display the main window on startup */ - function __construct() + public function __construct() { parent::__construct(); @@ -43,7 +43,7 @@ class Main extends GtkWindow { /** * Display About menu with version information */ - function about() + public function about() { $dlg = new GtkAboutDialog(); $dlg->set_transient_for($this); @@ -77,7 +77,7 @@ class Main extends GtkWindow { /** * Quits the GTK loop */ - function quit() + public function quit() { Gtk::main_quit(); } @@ -239,7 +239,7 @@ class Main extends GtkWindow { * @param GtkTreeModel $model * @param GtkTreeIter $iter */ - function set_label($col, $cell, $model, $iter) + public function set_label($col, $cell, $model, $iter) { $info = $model->get_value($iter, 0); $cell->set_property('text', $info->name); @@ -262,7 +262,7 @@ class Main extends GtkWindow { * * @return Add_DB object */ - function new_conn() + public function new_conn() { return new Add_DB(); }