View Source

<ac:macro ac:name="unmigrated-inline-wiki-markup"><ac:plain-text-body><![CDATA[{zone-template-instance:ZFDEV:Zend Proposal Zone Template}

{zone-data:component-name}
Zend_Db_Adapter_Odbtp_Mssql
{zone-data}

{zone-data:proposer-list}
[Michael Mayer|mailto:michael.mayer@zend.com]
{zone-data}

{zone-data:revision}
0.1 - 31 May 2007: Initial draft
{zone-data}

{zone-data: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.
{zone-data}

{zone-data:references}
* [Open Database Transport Protocol|odbtp.sourceforge.net]
* [Source Code|http://www.nulldevice.eu/files/Zend.zip]
{zone-data}

{zone-data:requirements}
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.
{zone-data}

{zone-data:dependencies}
* Zend_Db_Adapter_Abstract
* Zend_Db_Statement
{zone-data}

{zone-data: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.
{zone-data}

{zone-data:milestones}
The classes are already in production use.

* Milestone 1: Check for bugs and write unit tests; test transaction support
* Milestone 3: Write documentation
{zone-data}

{zone-data:class-list}
* Zend_Db_Statement_Odbtp_Mssql
* Zend_Db_Statement_Odbtp_Exception
* Zend_Db_Adapter_Odbtp_Mssql
* Zend_Db_Adapter_Odbtp_Exception
{zone-data}

{zone-data:use-cases}
The typical use case is storing Unicode (UTF-8) strings in MS SQL databases.
{zone-data}

{zone-data:skeletons}
{code}

class Zend_Db_Adapter_Odbtp_Mssql extends Zend_Db_Adapter_Abstract {
protected $_config;
protected $_execute_mode;
protected $_lastInsertTable;
public function __construct(Array $config);
protected function _beginTransaction();
protected function _commit();
protected function _connect();
protected function _getExecuteMode();
protected function _quote($value);
public function describeTable($table, $schemaNAME = null);
public function fetchAssoc($sql, $bind);
public function insert($table, $bind);
public function lastInsertId($tableName, $primaryKey);
public function limit($sql, $count, $offset);
public function listTables();
public function prepare($sql);
public function quoteIdentifier($ident);
public function setFetchMode($mode);
public function update($table, $bind, $where);
}

{code}

The full source can be downloaded here:

http://www.nulldevice.eu/files/Zend.zip

{zone-data}

{zone-template-instance}]]></ac:plain-text-body></ac:macro>