Class ezSQL_pdo

Description

ezSQL class - PDO Desc..: PDO component (part of ezSQL databse abstraction library)

Located in /pdo/ez_sql_pdo.php (line 14)

ezSQLcore
   |
   --ezSQL_pdo
Variable Summary
boolean $show_errors
Method Summary
ezSQL_pdo __construct ([string $dsn = ''], [string $user = ''], [string $password = ''], [array $options = array()], [boolean $isFileBased = false])
string catch_error ()
boolean connect ([string $dsn = ''], [string $dbuser = ''], [string $dbpassword = ''], [array $options = array()], [boolean $isFileBased = false])
void disconnect ()
string escape (string $str)
string get_set (array $params)
object query (type $query)
boolean quick_connect ([string $dsn = ''], [string $user = ''], [string $password = ''], [array $options = array()], [boolean $isFileBased = false])
boolean select ([string $dsn = ''], [string $user = ''], [string $password = ''], [array $options = array()], [boolean $isFileBased = false])
string sysdate ()
Variables
Methods
Constructor __construct (line 81)

Constructor - allow the user to perform a qucik connect at the same time as initialising the ezSQL_sqlite class

  • access: public
ezSQL_pdo __construct ([string $dsn = ''], [string $user = ''], [string $password = ''], [array $options = array()], [boolean $isFileBased = false])
  • string $dsn: The connection parameter string Default is empty string
  • string $user: The database user name Default is empty string
  • string $password: The database password Default is empty string
  • array $options: Array for setting connection options as MySQL charset for example Default is an empty array
  • boolean $isFileBased: File based databases like SQLite don't need user and password, they work with path in the dsn parameter Default is false

Redefinition of:
ezSQLcore::__construct()
Constructor of ezSQL
catch_error (line 249)

Hooks into PDO error system and reports it to user

  • access: public
string catch_error ()
connect (line 118)

Try to connect to the database server in the DSN parameters

  • access: public
boolean connect ([string $dsn = ''], [string $dbuser = ''], [string $dbpassword = ''], [array $options = array()], [boolean $isFileBased = false])
  • string $dsn: The connection parameter string Default is empty string
  • string $dbuser: The database user name Default is empty string
  • string $dbpassword: The database password Default is empty string
  • array $options: Array for setting connection options as MySQL charset for example Default is an empty array
  • boolean $isFileBased: File based databases like SQLite don't need user and password, they work with path in the dsn parameter Default is false
disconnect (line 400)

Close the database connection

  • access: public
void disconnect ()
escape (line 222)

Escape a string with the PDO method

  • access: public
string escape (string $str)
  • string $str
get_set (line 425)

Creates a SET nvp sql string from an associative array (and escapes all values)

$db_data = array('login'=>'jv','email'=>'jv@vip.ie', 'user_id' => 1, 'created' => 'NOW()');

$db->query("INSERT INTO users SET ".$db->get_set($db_data));

...OR...

$db->query("UPDATE users SET ".$db->get_set($db_data)." WHERE user_id = 1");

Output:

login = 'jv', email = 'jv@vip.ie', user_id = 1, created = NOW()

  • access: public
string get_set (array $params)
  • array $params
query (line 278)

Basic Query - see docs for more detail

  • access: public
object query (type $query)
  • type $query
quick_connect (line 180)

With PDO it is only an alias for the connect method

  • access: public
boolean quick_connect ([string $dsn = ''], [string $user = ''], [string $password = ''], [array $options = array()], [boolean $isFileBased = false])
  • string $dsn: The connection parameter string Default is empty string
  • string $user: The database user name Default is empty string
  • string $password: The database password Default is empty string
  • array $options: Array for setting connection options as MySQL charset for example Default is an empty array
  • boolean $isFileBased: File based databases like SQLite don't need user and password, they work with path in the dsn parameter Default is false
select (line 207)

With PDO it is only an alias for the connect method

  • access: public
boolean select ([string $dsn = ''], [string $user = ''], [string $password = ''], [array $options = array()], [boolean $isFileBased = false])
  • string $dsn: The connection parameter string Default is empty string
  • string $user: The database user name Default is empty string
  • string $password: The database password Default is empty string
  • array $options: Array for setting connection options as MySQL charset for example Default is an empty array
  • boolean $isFileBased: File based databases like SQLite don't need user and password, they work with path in the dsn parameter Default is false
sysdate (line 240)

Return SQLite specific system date syntax i.e. Oracle: SYSDATE Mysql: NOW()

  • access: public
string sysdate ()

Inherited Methods

Inherited From ezSQLcore

ezSQLcore::__construct()
ezSQLcore::affectedRows()
ezSQLcore::debug()
ezSQLcore::donation()
ezSQLcore::dumpvar()
ezSQLcore::flush()
ezSQLcore::getShowErrors()
ezSQLcore::get_cache()
ezSQLcore::get_col()
ezSQLcore::get_col_info()
ezSQLcore::get_results()
ezSQLcore::get_row()
ezSQLcore::get_var()
ezSQLcore::hide_errors()
ezSQLcore::isConnected()
ezSQLcore::register_error()
ezSQLcore::show_errors()
ezSQLcore::store_cache()
ezSQLcore::timer_elapsed()
ezSQLcore::timer_get_cur()
ezSQLcore::timer_start()
ezSQLcore::timer_update_global()
ezSQLcore::vardump()
Class Constants

Documentation generated on Mon, 26 Aug 2013 23:22:23 +0200 by phpDocumentor 1.4.4