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

  • 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, 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 PostgreSQL database driver.
17:  *
18:  * @author     David Grudl
19:  * @package Nette\Database\Drivers
20:  */
21: class NPgSqlDriver extends NObject implements ISupplementalDriver
22: {
23:     /** @var array */
24:     public $supports = array('meta' => TRUE);
25: 
26:     /** @var NConnection */
27:     private $connection;
28: 
29: 
30: 
31:     public function __construct(NConnection $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:         // @see http://www.postgresql.org/docs/8.2/static/sql-syntax-lexical.html#SQL-SYNTAX-IDENTIFIERS
48:         return '"' . str_replace('"', '""', $name) . '"';
49:     }
50: 
51: 
52: 
53:     /**
54:      * Formats date-time for use in a SQL statement.
55:      */
56:     public function formatDateTime(DateTime $value)
57:     {
58:         return $value->format("'Y-m-d H:i:s'");
59:     }
60: 
61: 
62: 
63:     /**
64:      * Encodes string for use in a LIKE statement.
65:      */
66:     public function formatLike($value, $pos)
67:     {
68:         throw new NotImplementedException;
69:     }
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 .= ' LIMIT ' . (int) $limit;
80: 
81:         if ($offset > 0)
82:             $sql .= ' OFFSET ' . (int) $offset;
83:     }
84: 
85: 
86: 
87:     /**
88:      * Normalizes result row.
89:      */
90:     public function normalizeRow($row, $statement)
91:     {
92:         return $row;
93:     }
94: 
95: }
96: 
Nette Framework 2.0beta1 (for PHP 5.2) API API documentation generated by ApiGen 2.3.0