objSQL Utility Methods
The obj_escape() method escapes string data per each database type extension and is called from the objSQL class.
Returns: Escaped string
<?php
try
{
//Escape string data for database insertion or update
$desc = $dbh->obj_escape( "Lorem 'ipsum' dolor" );
$rs = $dbh->update( "mytable", array( "prod_desc" => $desc ), "id=56" );
if ( $dbh->obj_error() )
throw new Exception( $dbh->obj_error_message() );
echo $rs->obj_affected_rows();
}
catch ( Exception $e )
{
//log error and/or redirect user to error page
}
?>
The obj_info() method returns information about objSQL, the current database server and PHP version and is called from the objSQL class.
Returns: Array
<?php
print_r( $dbh->obj_info() );
/** Displays:
Array ( [OBJSQL_VERSION] => 3.0.1
[DATABASE_NAME] => mydb
[DATABASE_TYPE] => sqlite3
[DATABASE_VERSION] => 3.7.7.1
[DATABASE_CHARSET] => utf8
[PHP_VERSION] => 5.4.6 )
*/
?>