[Sf-Doctrine-MsSql] How to add convert nvarchar behaviour ?
Posted: Tue Apr 05, 2011 10:09 am
Hello everyone,
Here is an absolute problem which deals with Symfony - Doctrine - MSSQL Server - nvarchar fields (and converting this one).
Some SQL request cannot be executed because of nvarchar fields (Error : Unicode data in a Unicode-only collation or ntext data cannot be sent to clients using DB-Library (such as ISQL) or ODBC version 3.7 or earlier), this error disappear when the field is converting (CONVERT(VARBINARY(MAX), MyField) AS MyField), ok that's a point.
Now, if I use a MSSQL Server with Doctrine - PDO - Symfony, this system do not convert automatically the previous SQL request.
On the one hand, I was thinking that an own "actAs" behaviour which CONVERT() a field before it will be SELECTed, but (and can you confirm ?) an actAc does actions only on an UPDATE or an INSERT but not in a SELECT.
On the other hand, the other idea was to add an attribute to a table in the schema.yml file.
==>> Example :
state:
type: string(2147483646)
fixed: false
unsigned: false
notnull: false
primary: false
autoincrement: false
convertAsBinaryString: true
This attribute (convertAsBinaryString) doesn't exist but can we add somewhere a function to control CONVERTion of fields and which will recognize the convertAsBinaryString attribute ?
I hope you will understand the issue.
Best regards.
Steve.
Here is an absolute problem which deals with Symfony - Doctrine - MSSQL Server - nvarchar fields (and converting this one).
Some SQL request cannot be executed because of nvarchar fields (Error : Unicode data in a Unicode-only collation or ntext data cannot be sent to clients using DB-Library (such as ISQL) or ODBC version 3.7 or earlier), this error disappear when the field is converting (CONVERT(VARBINARY(MAX), MyField) AS MyField), ok that's a point.
Now, if I use a MSSQL Server with Doctrine - PDO - Symfony, this system do not convert automatically the previous SQL request.
On the one hand, I was thinking that an own "actAs" behaviour which CONVERT() a field before it will be SELECTed, but (and can you confirm ?) an actAc does actions only on an UPDATE or an INSERT but not in a SELECT.
On the other hand, the other idea was to add an attribute to a table in the schema.yml file.
==>> Example :
state:
type: string(2147483646)
fixed: false
unsigned: false
notnull: false
primary: false
autoincrement: false
convertAsBinaryString: true
This attribute (convertAsBinaryString) doesn't exist but can we add somewhere a function to control CONVERTion of fields and which will recognize the convertAsBinaryString attribute ?
I hope you will understand the issue.
Best regards.
Steve.