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.
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>.
20 namespace Doctrine\DBAL\Platforms;
23 * Platform to ensure compatibility of Doctrine with SQLServer2008 version.
25 * Differences to SQL Server 2005 and before are that a new DATETIME2 type was
26 * introduced that has a higher precision.
28 class SQLServer2008Platform extends SQLServer2005Platform
33 public function getDateTimeTypeDeclarationSQL(array $fieldDeclaration)
35 // 3 - microseconds precision length
36 // http://msdn.microsoft.com/en-us/library/ms187819.aspx
37 return 'DATETIME2(6)';
43 public function getDateTypeDeclarationSQL(array $fieldDeclaration)
51 public function getTimeTypeDeclarationSQL(array $fieldDeclaration)
59 public function getDateTimeFormatString()
61 return 'Y-m-d H:i:s.u';
67 public function getDateTimeTzFormatString()
69 return 'Y-m-d H:i:s.u P';
75 public function getDateFormatString()
83 public function getTimeFormatString()
91 * Adding Datetime2 Type
93 protected function initializeDoctrineTypeMappings()
95 parent::initializeDoctrineTypeMappings();
96 $this->doctrineTypeMapping['datetime2'] = 'datetime';
97 $this->doctrineTypeMapping['date'] = 'date';
98 $this->doctrineTypeMapping['time'] = 'time';