Class Horde_SQL

Description

This is a utility class, every method is static.

$Horde: framework/SQL/SQL.php,v 1.30.2.22 2009/09/25 07:55:38 selsky Exp $

Copyright 1999-2009 The Horde Project (http://www.horde.org/)

See the enclosed file COPYING for license information (LGPL). If you did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.

Located in /SQL/SQL.php (line 17)


	
			
Method Summary
 mixed buildClause ( &$dbh, string $lhs, string $op, string $rhs, [boolean $bind = false], [array $params = array()], DB $dbh)
 string escapePrepare (string $query)
 void insertBlob ( &$dbh,  $table,  $field,  $data,  $attributes)
 string insertValues ( &$dbh, array $values, DB $dbh)
 void readBlob ( &$dbh,  $table,  $field,  $criteria)
 void updateBlob ( &$dbh,  $table,  $field,  $data,  $where,  $alsoupdate)
 string updateValues ( &$dbh, array $values, DB $dbh)
Methods
buildClause (line 35)

Returns a boolean expression using the specified operator. Uses database-specific casting, if necessary.

  • return: The SQL test fragment, or an array containing the query and a list of values if $bind is true.
mixed buildClause ( &$dbh, string $lhs, string $op, string $rhs, [boolean $bind = false], [array $params = array()], DB $dbh)
  • DB $dbh: The PEAR::DB database object.
  • string $lhs: The column or expression to test.
  • string $op: The operator.
  • string $rhs: The comparison value.
  • boolean $bind: If true, the method returns the query and a list of values suitable for binding as an array.
  • array $params: Any additional parameters for the operator. @since Horde 3.2
  • &$dbh
escapePrepare (line 187)

Escapes all characters in a string that are placeholders for the prepare/execute methods of the DB package.

  • return: The correctly escaped string.
string escapePrepare (string $query)
  • string $query: A string to escape.
insertBlob (line 246)
void insertBlob ( &$dbh,  $table,  $field,  $data,  $attributes)
  • &$dbh
  • $table
  • $field
  • $data
  • $attributes
insertValues (line 426)

Build an SQL INSERT/VALUES clause.

This function takes an array in the form column => value and returns an SQL fragment specifying the column names and insert values, with the values properly quoted. For example, the following:

array('foo' => 1, 'bar' => 'hello')

would result in the fragment:

( foo, bar ) VALUES ( 1, 'hello' )

  • return: The SQL fragment.
string insertValues ( &$dbh, array $values, DB $dbh)
  • DB $dbh: The PEAR::DB database object.
  • array $values: The array of column => value pairs.
  • &$dbh
readBlob (line 192)
void readBlob ( &$dbh,  $table,  $field,  $criteria)
  • &$dbh
  • $table
  • $field
  • $criteria
updateBlob (line 308)
void updateBlob ( &$dbh,  $table,  $field,  $data,  $where,  $alsoupdate)
  • &$dbh
  • $table
  • $field
  • $data
  • $where
  • $alsoupdate
updateValues (line 398)

Build an SQL SET clause.

This function takes an array in the form column => value and returns an SQL SET clause (without the SET keyword) with the values properly quoted. For example, the following:

array('foo' => 1, 'bar' => 'hello')

would result in the fragment:

foo = 1, bar = 'hello'

  • return: The SQL SET fragment.
string updateValues ( &$dbh, array $values, DB $dbh)
  • DB $dbh: The PEAR::DB database object.
  • array $values: The array of column => value pairs.
  • &$dbh

Documentation generated on Sun, 30 Jan 2011 05:22:01 +0000 by phpDocumentor 1.4.3