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