What is Joda?
Joda is an initiative, an attempt to make Joomla! Framework and CMS mutli-database compatible. Currently, Joomla is firmly tied to MySQL database engine (due to historical reasons). Joda, as a minimum, should add to the supported list such widely used relational, SQL database servers as PostgreSQL and Microsoft SQL Server. Joda is developed as a replacement of the current Joomla Database Layer.
Features at a glance:
* Target database engines: MySQL, PostgreSQL, MSSQL
* Using PHP PDO data access library
* Using Prepared Statements
* Implementing basic ORM
What Joda isn't?
Joda is not a hyper-mega-all-mighty or universal PHP Database Abstraction Layer you can download and use in your own non-Joomla projects (like you do with PEAR or Zend Framework). It is not a plugin, component, module or extension. It is not a SQL translator. And finally, Joda is not Yoda, although the name was inspired by this little, cue, wise and powerful creature :-) [Wikipedia:Yoda]
Why Joda?
It is pretty straightforward: Joomla! community and user base is extremely fast growing, thus attracting people using different database engines. At some point the community realized that Joomla, being "MySQL only" or "too much MySQL", is missing an important feature: multi-database support. It is easy to spot this mood reading Joomla Forums. Do a quick search for "postgresql", "mssql" and "multi+database" and you get reasonable number of threads on this subject.
When?
Not planned. No oficial decision taken yet. Joda is a proposal, an attempt to make things better. You'll be informed as soon as it happens. When it's done. Does this ring the bell? [easter egg] :-)
PHP Compatibility
Joda class hierarchy inherits PHP PDO classes (PDO and PDOStatement). Since PDO is PHP 5.1+ feature, Joda is considered compatible with PHP version 5.1 or above. This is in perfect sync with the recent Development Team's decision to declare Joomla as PHP 5.2+ compatible starting from version 1.6 [see Joomla goes PHP5]
3rd party extensions and legacy issues
As a side, unavoidable effect, Joda will break backward compatibility between Joomla and existing 3rd party extensions. Some of them might be affected, others could still run error-free, but in general Joda should be considered legacy-ignorant. Nothing can be done against this. On a bright side, Joda won't happen unexpectedly and is not planned to be ready any soon :-) At least not before Joomla v2.0!
Architecture

Joda consists of two main parts: Database Abstraction and SQL Abstraction layers.
Database Abstraction Layer
This layer includes the following classes and their child classes:
class JConnection extends PDO
Responsible for:
- Connecting to the underlying database source and reporting problems
- Providing metadata - hard coded or dynamically retrieved form the data source
- Handling transactions if required, using different isolation levels
- Preparing (if required) and executing queries
- Fetching data rows and piping them to its owner (a JDataset object)
- more
class JDataset extends JObject
- Orders its Connection property to make connection and report status
- Uses its own JQueryBuilder property to build data base aware SQL queries
- Sends queries to JConnection class for execution
- Holds data, (the result set) in tabular format or array of objects
- Provides API to examine and manage data in its data structure
- more
class JRelation extends JDataset (Object Relational Mapping sub layer)
- Implements basic Object Relational Mapping concept
- Represents a single relation in the underlying data source, namely a table
- Provides API to retrieve data from and manage its counterpart table
- A semi-root class for all sub-classes that represent (hypothetically) all tables in the data source
- more
SQL Abstraction Layer
Includes the following class and its child classes:
JQueryBuilder
Responsible for one single task: building database specific SQL queries through unified, simple, readable and straightforward API.
Supports a predefined, hard coded set of SQL query types (query templates)
Outputs a list of queries (an array of strings).
Recommended Readings:
Joomla Forum: http://forum.joomla.org/viewtopic.php?f=326&t=195747
Joomla Dev Team's Google Group: http://groups.google.com/group/joomla-devel/browse_thread/thread/c84ffbd5ba1dedca
ORM: http://en.wikipedia.org/wiki/Object_Relational_Mapping
PDO: http://bg.php.net/PDO |