Databases

RFC #0159: Deadlock handling

at 2008-04-12 in DatabasesRFCs by friebe

Scope of Change
A new class rdbms.SQLDeadlockException will be introduced. The rdbms drivers will handle dead lock situations specially and throw this new exception instead of a generic SQLStatementFailedException.

Rationale
Deadlocks are a very special case in database systems and often need special programmatic handling.

Read the full RFC here



Tracking SQL statements sent

at 2007-07-18 in UnittestsDatabases by friebe

The XP framework's RDBMS access API offers logging of SQL queries sent to the server by adding observers to database connections:

<?php 
// First, set up logger
Logger::getInstance
()->getCategory('sql')->addAppender(new ConsoleAppender());

// Retrieve connection and add the log observer for the "sql" category to the connection
$conn= DriverManager::getConnection('sybase://user:pass@dbserv01');
$conn->addObserver(LogObserver::instanceFor('sql'));
?>

Now SQL statements and other connection events will be logged to the console. For most purposes, this will suffice.

If you need to store all SQL statements sent to the server in an array, for example to assert on them in unittest environments, here's how:


(more)

Database logging beautified

at 2007-07-05 in Databases by friebe

On a short note: Database logging output has been made more condense.

Old output:

[23:05:34 4248 debug] rdbms.DBEvent(query) {'select max(account_id) as `value` from test.account'} 
[23:05:34 4248 debug] rdbms.DBEvent(queryend) {MySQLResultSet::__set_state(array(
'handle' => NULL,
'fields' =>
array (
'value' => 'int',
),
'__id' => NULL,
))}
New output:
[23:06:09 4232 debug] rdbms.DBEvent(query) {"select max(account_id) as `value` from test.account"} 
[23:06:09 4232 debug] rdbms.DBEvent(queryend) {rdbms.mysql.MySQLResultSet(Resource id #140)@[
value => "int"
]}
I especially hated the ugly __set_state thing being generated by var_export():)



RFC #0131: Query class and operation

at 2007-07-03 in DatabasesRFCs by friebe

Scope of Change
Extends the rdbms critertia api

  • Query class that stores complete querys
  • set operations like union, intercept and except
Rationale
  • Store complete queries.
  • Provide a tool to represent set operations in criteria / OO world.
Read the full RFC here



Subscribe

You can subscribe to the XP framework's news by using RSS syndication.


Categories

News
General
PHP5
Announcements
RFCs
Further reading
Examples
Editorial
EASC
Experiments
Unittests
Databases