Zend Framework: Zend_Db_Adapter_Odbtp_Mssql Component Proposal
| Proposed Component Name | Zend_Db_Adapter_Odbtp_Mssql |
|---|---|
| Developer Notes | http://framework.zend.com/wiki/display/ZFDEV/Zend_Db_Adapter_Odbtp_Mssql |
| Proposers | Michael Mayer |
| Revision | 0.1 - 31 May 2007: Initial draft (wiki revision: 9) |
Table of Contents
1. Overview
Zend_Db_Adapter_Odbtp_Mssql is a database adapter for the Open Database Transport Protocol (ODBTP). It enables the usage of Unicode together with MS SQL Server. The default MS SQL database driver is not binary safe and can therefore not handle UTF-16 strings because they contain null bytes.
2. References
- [Open Database Transport Protocol]
- Source Code
3. Component Requirements, Constraints, and Acceptance Criteria
The database adapter requires that the odbtp extension is installed and activated (see the ODBTP for a detailed API description). A running ODBTP and SQL Server are also required to start a connection. As ODBTP uses UTF-8, there is no need for binary safe functions. Of course the multibyte extension is required to manipulate UTF-8 strings.
4. Dependencies on Other Framework Components
- Zend_Db_Adapter_Abstract
- Zend_Db_Statement
5. Theory of Operation
The ODBTP adapter is kind of a join of the existing ODBC (DB2) and MS SQL database adapters. It can be used as usual:
$db = Zend_Db::factory('ODBTP_MSSQL', $db_params);
It should be noted that there is a general probalem in database abstraction in Zend Framework, when dealing with date formats. ODBTP returns a date object by default; other adapters return strings for example. So this is something I would like to see fixed in future versions.
6. Milestones / Tasks
The classes are already in production use.
- Milestone 1: Check for bugs and write unit tests; test transaction support
- Milestone 3: Write documentation
7. Class Index
- Zend_Db_Statement_Odbtp_Mssql
- Zend_Db_Statement_Odbtp_Exception
- Zend_Db_Adapter_Odbtp_Mssql
- Zend_Db_Adapter_Odbtp_Exception
8. Use Cases
The typical use case is storing Unicode (UTF-8) strings in MS SQL databases.
9. Class Skeletons
The full source can be downloaded here:
ZF Home Page
Code Browser
Wiki Dashboard