Packages

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

Classes

  • NMsSqlDriver
  • NMySqlDriver
  • NOciDriver
  • NOdbcDriver
  • NPgSqlDriver
  • NSqlite2Driver
  • NSqliteDriver
  • 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 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 NOdbcDriver extends NObject implements ISupplementalDriver
 22: {
 23:     /** @var NConnection */
 24:     private $connection;
 25: 
 26: 
 27: 
 28:     public function __construct(NConnection $connection, array $options)
 29:     {
 30:         $this->connection = $connection;
 31:     }
 32: 
 33: 
 34: 
 35:     /********************* SQL ****************d*g**/
 36: 
 37: 
 38: 
 39:     /**
 40:      * Delimites identifier for use in a SQL statement.
 41:      */
 42:     public function delimite($name)
 43:     {
 44:         return '[' . str_replace(array('[', ']'), array('[[', ']]'), $name) . ']';
 45:     }
 46: 
 47: 
 48: 
 49:     /**
 50:      * Formats boolean for use in a SQL statement.
 51:      */
 52:     public function formatBool($value)
 53:     {
 54:         return $value ? '1' : '0';
 55:     }
 56: 
 57: 
 58: 
 59:     /**
 60:      * Formats date-time for use in a SQL statement.
 61:      */
 62:     public function formatDateTime(DateTime $value)
 63:     {
 64:         return $value->format("#m/d/Y H:i:s#");
 65:     }
 66: 
 67: 
 68: 
 69:     /**
 70:      * Encodes string for use in a LIKE statement.
 71:      */
 72:     public function formatLike($value, $pos)
 73:     {
 74:         $value = strtr($value, array("'" => "''", '%' => '[%]', '_' => '[_]', '[' => '[[]'));
 75:         return ($pos <= 0 ? "'%" : "'") . $value . ($pos >= 0 ? "%'" : "'");
 76:     }
 77: 
 78: 
 79: 
 80:     /**
 81:      * Injects LIMIT/OFFSET to the SQL query.
 82:      */
 83:     public function applyLimit(&$sql, $limit, $offset)
 84:     {
 85:         // offset support is missing
 86:         if ($limit >= 0) {
 87:             $sql = 'SELECT TOP ' . (int) $limit . ' * FROM (' . $sql . ')';
 88:         }
 89: 
 90:         if ($offset) {
 91:             throw new InvalidArgumentException('Offset is not implemented in driver odbc.');
 92:         }
 93:     }
 94: 
 95: 
 96: 
 97:     /**
 98:      * Normalizes result row.
 99:      */
100:     public function normalizeRow($row, $statement)
101:     {
102:         return $row;
103:     }
104: 
105: 
106: 
107:     /********************* reflection ****************d*g**/
108: 
109: 
110: 
111:     /**
112:      * Returns list of tables.
113:      */
114:     public function getTables()
115:     {
116:         throw new NNotImplementedException;
117:     }
118: 
119: 
120: 
121:     /**
122:      * Returns metadata for all columns in a table.
123:      */
124:     public function getColumns($table)
125:     {
126:         throw new NNotImplementedException;
127:     }
128: 
129: 
130: 
131:     /**
132:      * Returns metadata for all indexes in a table.
133:      */
134:     public function getIndexes($table)
135:     {
136:         throw new NNotImplementedException;
137:     }
138: 
139: 
140: 
141:     /**
142:      * Returns metadata for all foreign keys in a table.
143:      */
144:     public function getForeignKeys($table)
145:     {
146:         throw new NNotImplementedException;
147:     }
148: 
149: 
150: 
151:     /**
152:      * @return bool
153:      */
154:     public function isSupported($item)
155:     {
156:         return $item === self::SUPPORT_COLUMNS_META;
157:     }
158: 
159: }
160: 
Nette Framework 2.0.6 (for PHP 5.2, prefixed) API API documentation generated by ApiGen 2.7.0