this has nothing to do with the aforementioned error (operand type clash). 
In addition to that, TEXTSIZE just limits what a text, image, varbinary, 
varchar field is allowed to be fetched, not stored. 
Since web2py is using odbc, and odbc uses the max limit that you mention by 
default, if you're seeing something truncated it's not a web2py issue, but 
something related to your middleware setup (unixodbc or freetds). According 
to the docs, freetds sets implicitely 4294967295 (4 GB), so if you're not 
setting it explicitely, you should be good to go without further issues.

On Tuesday, February 10, 2015 at 8:56:43 PM UTC+1, Raul Monares wrote:
>
> I had a similar problem with truncated info in blob fields. This line 
> fixed for me:
>
>     db.executesql('SET TEXTSIZE 2147483647')
>
> right after the DAL connection
>
> On Tuesday, February 10, 2015 at 8:24:19 AM UTC-7, Jose wrote:
>>
>> Hello everyone
>>
>> I have the following:
>>
>> Web2py on Freebsd.
>> Database: SQLServer 2008
>>
>> Connection: web2py <-> pyodbc <-> UnixODBC <-> FreeTDS <-> SQLServer
>>
>> I'm trying to store some uploaded files into a blob field, instead than 
>> on the file system.
>>
>> The table was created by the administrator SQLServer
>>
>> CREATE TABLE [dbo].[DocumentosBlob](
>> [Id] [numeric](18, 0) IDENTITY(1,1) NOT NULL,
>> [Nombre] [varchar](50) NULL,
>> [Archivo] [varchar](512) NULL,
>> [Archivo_Blob] [text] NULL,
>> [Archivo_Blob2] [image] NULL
>> ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
>>
>>
>>
>>
>> The adapter defines SQLServer blob fields as IMAGE ('blob': 'IMAGE',). 
>> Then use for testing the Archivo_Blob2 field is set to IMAGE
>> In my model I have:
>>
>> tb_documentos_blob = db.define_table('DocumentosBlob',
>>     Field('nombre', length=50),
>>     Field('archivo', 'upload', uploadfield='archivo_blob2'),
>>     Field('archivo_blob2', 'blob', writable=False, readable=False),
>>     migrate=False,
>> )
>>
>>
>>
>> But it happens that when trying to upload a file upload the following 
>> error occurs:
>>
>> *DataError: ('22018', '[22018] [FreeTDS][SQL Server]Operand type clash: 
>> text is incompatible with image (206) (SQLExecDirectW)')*
>>
>> Then I changed the field, using one type TEXT (Archivo_Blob). The model 
>> will now be:
>>
>> tb_documentos_blob = db.define_table('DocumentosBlob',
>>     Field('nombre', length=50),
>>     Field('archivo', 'upload', uploadfield='archivo_blob'),
>>     Field('archivo_blob', 'blob', writable=False, readable=False),
>>     migrate=False,
>> )
>>
>>
>>
>> Now it works, I can upload and download files, but only with very small 
>> files. Tested with 20KB. With one of 250KB upload it, but at download it is 
>> broken. I imagine that was truncated when stored in the database.
>>
>> How I can fix this?
>>
>> Best Regards
>> José
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to