Packages

  • Nette
    • Application
      • Application\Diagnostics
      • Application\Responses
      • Application\Routers
      • Application\UI
    • Caching
      • Caching\Storages
    • ComponentModel
    • Config
    • Database
      • Database\Diagnostics
      • Database\Drivers
      • Database\Reflection
      • Database\Table
    • DI
    • Diagnostics
    • Forms
      • Forms\Controls
      • Forms\Rendering
    • Http
    • Iterators
    • Latte
      • Latte\Macros
    • Loaders
    • Localization
    • Mail
    • Reflection
    • Security
    • Templating
    • Utils
  • NetteModule
  • None
  • PHP

Classes

  • MsSqlDriver
  • MySqlDriver
  • OciDriver
  • OdbcDriver
  • PgSqlDriver
  • Sqlite2Driver
  • SqliteDriver
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: 
 3: /**
 4:  * This file is part of the Nette Framework (http://nette.org)
 5:  *
 6:  * Copyright (c) 2004, 2011 David Grudl (http://davidgrudl.com)
 7:  *
 8:  * For the full copyright and license information, please view
 9:  * the file license.txt that was distributed with this source code.
10:  * @package Nette\Database\Drivers
11:  */
12: 
13: 
14: 
15: /**
16:  * Supplemental ODBC database driver.
17:  *
18:  * @author     David Grudl
19:  * @package Nette\Database\Drivers
20:  */
21: class OdbcDriver extends Object implements ISupplementalDriver
22: {
23:     /** @var array */
24:     public $supports = array('meta' => TRUE);
25: 
26:     /** @var Connection */
27:     private $connection;
28: 
29: 
30: 
31:     public function __construct(Connection $connection, array $options)
32:     {
33:         $this->connection = $connection;
34:     }
35: 
36: 
37: 
38:     /********************* SQL ****************d*g**/
39: 
40: 
41: 
42:     /**
43:      * Delimites identifier for use in a SQL statement.
44:      */
45:     public function delimite($name)
46:     {
47:         return '[' . str_replace(array('[', ']'), array('[[', ']]'), $name) . ']';
48:     }
49: 
50: 
51: 
52:     /**
53:      * Formats date-time for use in a SQL statement.
54:      */
55:     public function formatDateTime(DateTime $value)
56:     {
57:         return $value->format("#m/d/Y H:i:s#");
58:     }
59: 
60: 
61: 
62:     /**
63:      * Encodes string for use in a LIKE statement.
64:      */
65:     public function formatLike($value, $pos)
66:     {
67:         $value = strtr($value, array("'" => "''", '%' => '[%]', '_' => '[_]', '[' => '[[]'));
68:         return ($pos <= 0 ? "'%" : "'") . $value . ($pos >= 0 ? "%'" : "'");
69:     }
70: 
71: 
72: 
73:     /**
74:      * Injects LIMIT/OFFSET to the SQL query.
75:      */
76:     public function applyLimit(&$sql, $limit, $offset)
77:     {
78:         // offset support is missing
79:         if ($limit >= 0) {
80:             $sql = 'SELECT TOP ' . (int) $limit . ' * FROM (' . $sql . ')';
81:         }
82: 
83:         if ($offset) {
84:             throw new InvalidArgumentException('Offset is not implemented in driver odbc.');
85:         }
86:     }
87: 
88: 
89: 
90:     /**
91:      * Normalizes result row.
92:      */
93:     public function normalizeRow($row, $statement)
94:     {
95:         return $row;
96:     }
97: 
98: }
99: 
Nette Framework 2.0beta1 (for PHP 5.2) API API documentation generated by ApiGen 2.3.0