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

Classes

  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Other releases
  • Nette homepage
  1: <?php
  2: 
  3: /**
  4:  * This file is part of the Nette Framework (https://nette.org)
  5:  * Copyright (c) 2004 David Grudl (http://davidgrudl.com)
  6:  * @package Nette\Database\Drivers
  7:  */
  8: 
  9: 
 10: 
 11: /**
 12:  * Supplemental ODBC database driver.
 13:  *
 14:  * @author     David Grudl
 15:  * @package Nette\Database\Drivers
 16:  */
 17: class OdbcDriver extends Object implements ISupplementalDriver
 18: {
 19: 
 20:     /********************* SQL ****************d*g**/
 21: 
 22: 
 23:     /**
 24:      * Delimites identifier for use in a SQL statement.
 25:      */
 26:     public function delimite($name)
 27:     {
 28:         return '[' . str_replace(array('[', ']'), array('[[', ']]'), $name) . ']';
 29:     }
 30: 
 31: 
 32:     /**
 33:      * Formats boolean for use in a SQL statement.
 34:      */
 35:     public function formatBool($value)
 36:     {
 37:         return $value ? '1' : '0';
 38:     }
 39: 
 40: 
 41:     /**
 42:      * Formats date-time for use in a SQL statement.
 43:      */
 44:     public function formatDateTime(DateTime $value)
 45:     {
 46:         return $value->format('#m/d/Y H:i:s#');
 47:     }
 48: 
 49: 
 50:     /**
 51:      * Encodes string for use in a LIKE statement.
 52:      */
 53:     public function formatLike($value, $pos)
 54:     {
 55:         $value = strtr($value, array("'" => "''", '%' => '[%]', '_' => '[_]', '[' => '[[]'));
 56:         return ($pos <= 0 ? "'%" : "'") . $value . ($pos >= 0 ? "%'" : "'");
 57:     }
 58: 
 59: 
 60:     /**
 61:      * Injects LIMIT/OFFSET to the SQL query.
 62:      */
 63:     public function applyLimit(& $sql, $limit, $offset)
 64:     {
 65:         if ($limit >= 0) {
 66:             $sql = 'SELECT TOP ' . (int) $limit . ' * FROM (' . $sql . ')';
 67:         }
 68: 
 69:         if ($offset) {
 70:             throw new InvalidArgumentException('Offset is not implemented in driver odbc.');
 71:         }
 72:     }
 73: 
 74: 
 75:     /**
 76:      * Normalizes result row.
 77:      */
 78:     public function normalizeRow($row, $statement)
 79:     {
 80:         return $row;
 81:     }
 82: 
 83: 
 84:     /********************* reflection ****************d*g**/
 85: 
 86: 
 87:     /**
 88:      * Returns list of tables.
 89:      */
 90:     public function getTables()
 91:     {
 92:         throw new NotImplementedException;
 93:     }
 94: 
 95: 
 96:     /**
 97:      * Returns metadata for all columns in a table.
 98:      */
 99:     public function getColumns($table)
100:     {
101:         throw new NotImplementedException;
102:     }
103: 
104: 
105:     /**
106:      * Returns metadata for all indexes in a table.
107:      */
108:     public function getIndexes($table)
109:     {
110:         throw new NotImplementedException;
111:     }
112: 
113: 
114:     /**
115:      * Returns metadata for all foreign keys in a table.
116:      */
117:     public function getForeignKeys($table)
118:     {
119:         throw new NotImplementedException;
120:     }
121: 
122: 
123:     /**
124:      * @return bool
125:      */
126:     public function isSupported($item)
127:     {
128:         return $item === self::SUPPORT_COLUMNS_META;
129:     }
130: 
131: }
132: 
Nette Framework 2.0.18 (for PHP 5.2, un-prefixed) API documentation generated by ApiGen 2.8.0