lib/ezdb/classes/ezdbinterface.php
File containing the eZDBInterface class.
- Copyright
- Copyright (C) 1999-2011 eZ Systems AS. All rights reserved.
- License
-
eZ Business Use License Agreement Version 2.0
- Package
- lib
- Version
- 4.6.0
Package: libFile containing the eZDBInterface class.
- Children
- \eZMySQLDB
- \eZMySQLiDB
- \eZNullDB
- \eZPostgreSQLDB
- Copyright
- Copyright (C) 1999-2011 eZ Systems AS. All rights reserved.
- License
-
eZ Business Use License Agreement Version 2.0
- Version
- 4.6.0
Constants


RELATION_SEQUENCE_BIT
= 2


ERROR_MISSING_EXTENSION
= 1
Properties



int
$errorHandling= 'eZDB::ERROR_HANDLING_STANDARD'
Error handling mechanism
One of the eZDB::ERROR_HANDLING_* constants
Default valueeZDB::ERROR_HANDLING_STANDARD
Details
- Type
- int
Methods



generateSQLINStatement(
int | array $elements, string $columnName
=
'', bool $not
=
false, \$unique $unique
=
true, \$type $type
=
false
)
:
string
This function can be used to create a SQL IN statement to be used in a WHERE clause:
WHERE columnName IN ( element1, element2, ... )
By default, the elements that can be submitted as an anonymous array (or an integer value
in case of a single element) will just be imploded. Drivers for databases with a limitation
of the elements within an IN statement have to reimplement this function. It is also possible
to negate the "IN" to a "NOT IN" by using the last parameter of this function.
Usage:
$db =& eZDb::instance();
$db->generateSQLINStatement( array( 2, 5, 43, ) );
Parameters
Name |
Type |
Description |
$elements |
int | array |
Elements that should (not) be matched by the IN statment as an integer or anonymous array
|
$columnName |
string |
Column name of the database table the IN statement should be created for |
$not |
bool |
Will generate a "NOT IN" ( if set to \c true ) statement instead of an "IN" ( if set to false , default )
|
$unique |
\$unique |
Wether or not to make the array unique. Not implemented in this class, but can be used by extending classes (oracle does use it)
|
$type |
\$type |
The type to cast the array elements to |
Returns
Type |
Description |
string |
A string with the correct IN statement like for example "columnName IN ( element1, element2 )" |



implodeWithTypeCast(
string $glue, array $pieces, \$type $type
)
:
string
Casts elements of \a $pieces to type $type and returns them as string
separated by $glue.
Parameters
Name |
Type |
Description |
$glue |
string |
The separator. |
$pieces |
array |
The array containing the elements. |
$type |
\$type |
The type to cast to. |
Returns
Details
- Example
- implodeWithTypeCast( ',', $myArray, 'int' )
- Note
- : Use generateSQLINStatement() if you intent to use this for IN statments!



setErrorHandling(
int $errorHandling
)
:
void
Sets the eZDB error handling mode
Parameters
Name |
Type |
Description |
$errorHandling |
int |
Possible values are:pm - eZDB::ERROR_HANDLING_STANDARD: backward compatible error handling, using reportError - eZDB::ERROR_HANDLING_EXCEPTION: using exceptions
|
Details
- Since
- 4.5