Propose changing instances of:
Piwik_Query($sql, $optional_parameter_array); // or Zend_Registry::get('db')->query($sql, $optional_parameter_array);
The $sql is moved into Query classes, defined in:
(Any of the above is acceptable and handled by the autoloader.)
Piwik_Repository::execute($queryName, $parameters) could be something like:
$schemaClassName = 'Piwik_Db_Query_' . Zend_Registry::get('schema'); $query = $schemaClassName::factory($queryName, $parameters); $db = Zend_Registry::get('db'); return $db->query($query, $parameters);
The factory method returns an object or string (e.g., schema-specific SQL). Non-MySQL schemas can either:
The prefix on the query name tells the factory method how to construct the class name. A query name prefixed by Db is treated as a core query. A query name prefixed by the plugin's name, e.g., GeoIP refers to a query in the GeoIP plugin's Query folder.
Considering that the 1.0 version jump will increase popularity of Piwik and more developers might start developing plugins, shouldn't we have a stable data access layer by then? (meaning: Shouldn't the target version be 1.0 instead of after 1.0?)
If you guys need help making these changes, I'm more than happy to help.
Post-1.0 means it isn't on the 1.0 roadmap, and that 1.0's release doesn't depend on this feature. Any/all help is welcome since many have asked for this feature, and it currently isn't the highest priority on my plate.
I've glossed over some implementation details, so feel free to ask questions, request feedback on patches, or prod me on some task.
We should also reconsider using Zend for the Tracker.
I moved some items from 'additional ideas' to TODO.
Side note: this Data access abstraction would make it easier to build sharding into Piwik, as we could have a Sharding schema, subclassing Mysql, that would modify queries to access the right shard when applicable.
(In ) refs #1368 - remove deprecated functions: prefixTable (since 0.2.27), isPhpCliMode (since 0.4.4), and getMysqlVersion (since 0.4.4)
(In ) refs #1368 - initial refactoring of MySQL schema methods from Piwik.php
(In ) refs #1368 - rename Piwik_Db_iAdapter to Piwik_Db_Adapter_Interface for consistency
(In ) refs #1368 - further refactoring of Piwik.php; initial abstraction of MySQL schema
(In ) refs #1368 - move low-level $dbInfos mangling to adapter
(In ) refs #1335, refs #1368 - check in Jason's Piwik_Db_Adapter_Pdo_Mssql class (excluding the schema and query methods being refactored elsewhere; edited to conform to coding style guidelines; note: a lot of the logic in getConnection() looks like it should be moved upstream to ZF (2.0 CTP1 related?) especially if CTP2 introduces breaking changes to the DSN
(In ) refs #1368 - preprocessing the SQL to be made obsolete by query classes/methods
(In ) refs #1368 - more refactoring and phpdocs
(In ) refs #1368 - implemented isAvailable() and private method hasStorageEngine(); added Schema.loadSchema hook for Sharding plugin; more phpdocs
(In ) refs #1368 - use schema instead of adapter; in strict mode, update() can't be abstract
Moving as it is more long term project
This will definitely be worked on to some extent (most likely: tracking code, archiving code for performance optimization) in 1.x, but it will be fully implemented (eg. sites/users/goals SQL will stay as is).
Are there any updates?
Is it possible to get piwik at least tracking with mssql?
dk-at-cabag: if there were updates, it would appear here in the trac log. This is a low priority enhancement. In terms of timeframe, I plan to work on this after the plugins repository is online.
re: mssql. You can try to port Jason's code (see #1335) to the latest Piwik release.