[Sf-Doctrine-MsSql] How to add convert nvarchar behaviour ?

Discussion for various published PHP frameworks, including Zend Framework, CodeIgniter, Kohana, CakePHP, Yii, Symfony, and others.

Moderator: General Moderators

Post Reply
styvodiabolo
Forum Newbie
Posts: 13
Joined: Tue May 19, 2009 2:18 pm

[Sf-Doctrine-MsSql] How to add convert nvarchar behaviour ?

Post by styvodiabolo »

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.
Post Reply