Rajout de doctrine/orm
[zf2.biz/galerie.git] / vendor / doctrine / dbal / lib / Doctrine / DBAL / Platforms / SQLServer2008Platform.php
1 <?php
2 /*
3  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
4  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
5  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
6  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
7  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
8  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
9  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
10  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
11  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
12  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
13  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14  *
15  * This software consists of voluntary contributions made by many individuals
16  * and is licensed under the MIT license. For more information, see
17  * <http://www.doctrine-project.org>.
18  */
19
20 namespace Doctrine\DBAL\Platforms;
21
22 /**
23  * Platform to ensure compatibility of Doctrine with SQLServer2008 version.
24  *
25  * Differences to SQL Server 2005 and before are that a new DATETIME2 type was
26  * introduced that has a higher precision.
27  */
28 class SQLServer2008Platform extends SQLServer2005Platform
29 {
30     /**
31      * {@inheritDoc}
32      */
33     public function getDateTimeTypeDeclarationSQL(array $fieldDeclaration)
34     {
35         // 3 - microseconds precision length
36         // http://msdn.microsoft.com/en-us/library/ms187819.aspx
37         return 'DATETIME2(6)';
38     }
39
40     /**
41      * {@inheritDoc}
42      */
43     public function getDateTypeDeclarationSQL(array $fieldDeclaration)
44     {
45         return 'DATE';
46     }
47
48     /**
49      * {@inheritDoc}
50      */
51     public function getTimeTypeDeclarationSQL(array $fieldDeclaration)
52     {
53         return 'TIME(0)';
54     }
55
56     /**
57      * {@inheritDoc}
58      */
59     public function getDateTimeFormatString()
60     {
61         return 'Y-m-d H:i:s.u';
62     }
63
64     /**
65      * {@inheritDoc}
66      */
67     public function getDateTimeTzFormatString()
68     {
69         return 'Y-m-d H:i:s.u P';
70     }
71
72     /**
73      * {@inheritDoc}
74      */
75     public function getDateFormatString()
76     {
77         return 'Y-m-d';
78     }
79
80     /**
81      * {@inheritDoc}
82      */
83     public function getTimeFormatString()
84     {
85         return 'H:i:s';
86     }
87
88     /**
89      * {@inheritDoc}
90      *
91      * Adding Datetime2 Type
92      */
93     protected function initializeDoctrineTypeMappings()
94     {
95         parent::initializeDoctrineTypeMappings();
96         $this->doctrineTypeMapping['datetime2'] = 'datetime';
97         $this->doctrineTypeMapping['date'] = 'date';
98         $this->doctrineTypeMapping['time'] = 'time';
99     }
100 }