#1267: Constraints (unique, index) in createTable()-Options produce errors with
Mssql
---------------------------+------------------------------------------------
Reporter: temp | Owner: jwage
Type: defect | Status: new
Priority: major | Milestone: 1.0.4
Component: Schema Files | Version: 1.0.0
Resolution: | Keywords: mssql
Has_test: 0 | Mystatus: Pending Core Response
Has_patch: 0 |
---------------------------+------------------------------------------------
Old description:
> Version 0.11.1
>
> A table definiton with these options:
>
> {{{
> array(
> 'options' => array(
> 'primary' => array('id'),
> 'indexes' => array(
> 'elementtype_unique_idx_0' => array(
> 'type' => 'unique',
> 'fields' => array(
> 'unique_id',
> ),
> ),
> ),
> )
> }}}
>
> results in this error with MSSQL:
>
> {{{
> SQLSTATE[HY000]: General error: 20018 Incorrect syntax near 'INDEX'. If
> this is intended as a part of a table hint, A WITH keyword and
> parenthesis are now required. See SQL Server Books Online for proper
> syntax. [20018] (severity 5) [CREATE TABLE [mw_elementtype] ([id] INT NOT
> NULL, [unique_id] VARCHAR(255) NOT NULL, [type] VARCHAR(20) NOT NULL,
> [create_uid] CHAR(36) NOT NULL, [create_time] CHAR(19) NOT NULL,
> [modify_uid] CHAR(36) NOT NULL, [modify_time] CHAR(19) NOT NULL, PRIMARY
> KEY(id), UNIQUE INDEX [elementtype_unique_idx_0] ([unique_id]))]' in
> [...]
> }}}
>
> I have to use createIndex() for it to work. With MySQL this worked.
New description:
Version 0.11.1
A table definiton with these options:
{{{
array(
'options' => array(
'primary' => array('id'),
'indexes' => array(
'elementtype_unique_idx_0' => array(
'type' => 'unique',
'fields' => array(
'unique_id',
),
),
),
)
}}}
results in this error with MSSQL:
{{{
SQLSTATE[HY000]: General error: 20018 Incorrect syntax near 'INDEX'. If
this is intended as a part of a table hint, A WITH keyword and parenthesis
are now required. See SQL Server Books Online for proper syntax. [20018]
(severity 5) [CREATE TABLE [mw_elementtype] ([id] INT NOT NULL,
[unique_id] VARCHAR(255) NOT NULL, [type] VARCHAR(20) NOT NULL,
[create_uid] CHAR(36) NOT NULL, [create_time] CHAR(19) NOT NULL,
[modify_uid] CHAR(36) NOT NULL, [modify_time] CHAR(19) NOT NULL, PRIMARY
KEY(id), UNIQUE INDEX [elementtype_unique_idx_0] ([unique_id]))]' in [...]
}}}
I have to use createIndex() for it to work. With MySQL this worked.
Comment (by guilhermeblanco):
CREATE TABLE syntax for MSSQL:
http://msdn.microsoft.com/en-us/library/ms174979.aspx
--
Ticket URL: <http://trac.doctrine-project.org/ticket/1267#comment:6>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"doctrine-svn" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.co.uk/group/doctrine-svn?hl=en-GB
-~----------~----~----~----~------~----~------~--~---