LiveUser_Admin
[ class tree: LiveUser_Admin ] [ index: LiveUser_Admin ] [ all elements ]

Class: LiveUser_Admin_Storage_SQL

Source Location: /LiveUser_Admin-0.4.0/Storage/SQL.php

Class Overview

LiveUser_Admin_Storage
   |
   --LiveUser_Admin_Storage_SQL

This is a SQL backend driver for the LiveUser class.


Author(s):

Version:

  • Release: @package_version@

Copyright:

  • 2002-2006 Markus Wolff

Variables

Methods


Child classes:

LiveUser_Admin_Storage_PDO
This is a PECL::PDO backend driver for the LiveUser class.
LiveUser_Admin_Storage_MDB2
This is a PEAR::MDB2 backend driver for the LiveUser class.
LiveUser_Admin_Storage_MDB
This is a PEAR::MDB backend driver for the LiveUser class.
LiveUser_Admin_Storage_DB
This is a PEAR::DB backend driver for the LiveUser class.

Inherited Variables

Inherited Methods

Class: LiveUser_Admin_Storage

LiveUser_Admin_Storage::LiveUser_Admin_Storage()
Constructor
LiveUser_Admin_Storage::disconnect()
properly disconnect from resources
LiveUser_Admin_Storage::init()
Initializes database storage container.
LiveUser_Admin_Storage::setSelectDefaultParams()
Static method to set defaults into a select params array

Class Details

[line 90]
This is a SQL backend driver for the LiveUser class.

A database connection object can be passed to the constructor to reuse an existing connection. Alternatively, a DSN can be passed to open a new one.

Requirements:

  • File "Liveuser.php" (contains the parent class "LiveUser")
  • Array of connection options or a PEAR::MDB2 connection object must be passed to the constructor. Example: array('dsn' => 'mysql://user:pass@host/db_name') OR &$conn (PEAR::MDB2 connection object)



[ Top ]


Class Variables

$prefix =  'liveuser_'

[line 122]

Table prefix for all db tables the container has.
  • Access: public

Type:   string


[ Top ]



Method Detail

createDelete   [line 310]

string createDelete( string $table, array $filters)

Create the SQL necessary for an delete
  • Return: SQL delete query
  • Access: public

Parameters:

string   $table   —  name of the table
array   $filters   —  array containing the filtering to apply

[ Top ]

createInsert   [line 205]

string createInsert( string $table, array $fields, array $values)

Create the SQL necessary for an insert
  • Return: SQL insert query
  • Access: public

Parameters:

string   $table   —  name of the table
array   $fields   —  array of field names
array   $values   —  array of quoted values

[ Top ]

createJoinFilter   [line 740]

bool|array createJoinFilter( string $root_table, array $filters, array $tables, array $selectable_tables, [array $visited = array()], [ $depth = 0])

Recursively find all the tables that need to be joined to be able to select all requested columns and to be able to filter the joined rows
  • Return: false on failure
  • Access: public

Parameters:

string   $root_table   —  name of the table from which to start looking for join points
array   $filters   —  list of fields to fetch
array   $tables   —  list of tables that are joined
array   $selectable_tables   —  list of tables that may be joined to
array   $visited   —  array of table already visisted to prevent infinite recursions
   $depth   — 

[ Top ]

createSelect   [line 439]

bool|string createSelect( array $fields, array $filters, array $orders, string $root_table, array $selectable_tables)

Create the SQL necessary for a select
  • Return: false on failure or a string with SQL query
  • Access: public

Parameters:

array   $fields   —  list of fields to fetch
array   $filters   —  key values pairs (value may be a string or an array)
array   $orders   —  key value pairs (values 'ASC' or 'DESC')
string   $root_table   —  name of the table from which to start looking for join points
array   $selectable_tables   —  list of tables that may be joined to

[ Top ]

createUpdate   [line 271]

string createUpdate( string $table, array $fields, array $filters)

Create the SQL necessary for an update
  • Return: SQL update query
  • Access: public

Parameters:

string   $table   —  name of the table
array   $fields   —  array of field names
array   $filters   —  array containing the filtering to apply

[ Top ]

createWhere   [line 496]

bool|string createWhere( array $filters, [array $joinfilters = array()])

Create the SQL necessary for a where statement
  • Return: false on failure or string with SQL WHERE
  • Access: public

Parameters:

array   $filters   —  key values pairs (value may be a string or an array)
array   $joinfilters   —  key values pairs of join related filters

[ Top ]

delete   [line 288]

int|bool delete( string $table, array $filters)

Delete from a table based given filters
  • Return: false on error, the affected rows on success
  • Access: public

Parameters:

string   $table   —  name of the table
array   $filters   —  key values pairs (value may be a string or an array)

[ Top ]

disconnect   [line 900]

void disconnect( )

Properly disconnect from database
  • Access: public

Overrides LiveUser_Admin_Storage::disconnect() (properly disconnect from resources)
[ Top ]

findTables   [line 601]

bool|array findTables( array &$fields, array &$filters, array &$orders, array $selectable_tables)

Find all the tables that need to be joined to be able to select all requested columns and to be able to filter the joined rows
  • Return: of table names required or false on failure
  • Access: public

Parameters:

array   &$fields   —  list of fields to fetch
array   &$filters   —  key values pairs (value may be a string or an array)
array   &$orders   —  key value pairs (values 'ASC' or 'DESC')
array   $selectable_tables   —  list of tables that may be joined to

[ Top ]

insert   [line 133]

int|bool insert( string $table, array $data)

Insert data into a table
  • Return: false on error, true (or new id) on success
  • Access: public

Parameters:

string   $table   —  name of the table
array   $data   —  key value pairs

[ Top ]

select   [line 375]

bool|array select( string $select, array $fields, array $filters, array $orders, bool $rekey, bool $group, string $limit, string $offset, string $root_table, array $selectable_tables)

Select data from a set of tables
  • Return: false on failure or array with selected data
  • Access: public

Parameters:

string   $select   —  determines what query method to use: 'one' -> queryOne, 'row' -> queryRow, 'col' -> queryCol, 'all' ->queryAll (default)
array   $fields   —  list of fields to fetch
array   $filters   —  key values pairs (value may be a string or an array)
array   $orders   —  key value pairs (values 'ASC' or 'DESC')
bool   $rekey   —  if set to true, returned array will have the first column as its first dimension
bool   $group   —  if set to true and $rekey is set to true, then all values with the same first column will be wrapped in an array
string   $limit   —  number of rows to select
string   $offset   —  first row to select
string   $root_table   —  name of the table from which to start looking for join points
array   $selectable_tables   —  list of tables that may be joined to

[ Top ]

selectCount   [line 328]

bool|int selectCount( string $table, string $field, array $filters)

Fetches the count of many rows contain the filtered data
  • Return: false on failure and integer of how many rows contain the filtered data
  • Access: public

Parameters:

string   $table   —  name of the table
string   $field   —  field name to count
array   $filters   —  key values pairs (value may be a string or an array)

[ Top ]

update   [line 223]

int|bool update( string $table, array $data, array $filters)

Update data in a table based given filters
  • Return: false on error, the affected rows on success
  • Access: public

Parameters:

string   $table   —  name of the table
array   $data   —  key value pairs
array   $filters   —  key values pairs (value may be a string or an array)

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:39:43 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.