i use a mssql adapter to connect to mssql with my Phalcon project.
i have got a problem with mssql and the database's field type "varbinary(MAX)" . The "varbinary(MAX)" in mssql are used to store images.
When i save my model using mssql i get this error.
PDOException : SQLSTATE: [Microsoft][SQL Server Native Client 11.0][SQL Server]Implicit conversion from data type varchar(max) to varbinary(max) is not allowed. Use the CONVERT function to run this query.
According with Microsoft i have to convert the type in the query SQL, like you can see in the examples below:
//INSERT $query = "INSERT INTO images (ext, size, image) VALUES ('$ext', $filesize, CONVERT(varbinary(MAX),'$data'))"; //SELECT $sql = "SELECT CONVERT(varchar(MAX), 'image') as image FROM images WHERE image_id = '$id'";
My question is: How can i do this using my model class in Phlacon ?