Class Og::MysqlBackend
In: lib/og/backends/mysql.rb
Parent: Og::Backend

Implements a MySQL powered backend.

Methods

Constants

TYPEMAP = { Integer => 'integer', Fixnum => 'integer', Float => 'float', String => 'text', Time => 'timestamp', Date => 'date', TrueClass => 'tinyint', Object => 'text', Array => 'text', Hash => 'text'   A mapping between Ruby and SQL types.

Public Class methods

generate the mapping of the database fields to the object properties.

Output YYY-mm-dd TODO: Optimize this

Escape an SQL string

Generate the property for oid.

Returns the code that actually inserts the object into the database. Returns the code as String.

Intitialize the connection to the RDBMS.

Input YYYY-mm-dd TODO: Optimize this

Parse sql datetime TODO: Optimize this

Returns the props that will be included in the insert query. The oid property is rejected because it is mapped to an AUTO_INCREMENT column.

Return an evaluator for reading the property. No need to optimize this, used only to precalculate code.

Convert a ruby time to an sql timestamp. TODO: Optimize this

Return an sql string evaluator for the property. No need to optimize this, used only to precalculate code. YAML is used to store general Ruby objects to be more portable.

FIXME: add extra handling for float.

Public Instance methods

Commit a transaction.

Create the managed object table. The properties of the object are mapped to the table columns. Additional sql relations and constrains are created (indicices, sequences, etc).

Deserialize all rows of the resultset.

Deserialize one row of the resultset.

Execute an SQL query, no result returned.

Return a single integer value from the resultset.

Execute an SQL query and return the result

Rollback transaction.

Execute an SQL query, no result returned. Wrapped in a rescue block.

Execute an SQL query and return the result. Wrapped in a rescue block.

Start a new transaction.

Check if it is a valid resultset.

[Validate]