For MSSQL the bit is stored.  With MySQL the evaluations work correctly - 
with MSSQL they do not so wondering if there is an infra issue. 

I have tried both mssql and mssql2 - I was under the impression that mssql2 
would stor the char T and F however that is not the case.

On Tuesday, May 1, 2012 7:26:41 AM UTC-6, Johann Spies wrote:
>
>
>
> On 1 May 2012 10:33, David Rager <[email protected]> wrote:
>
>> All - 
>> Am starting a large-scale project to monitor solar plants using web2py 
>> and python as the main app layer.
>>
>> I am also using mssql so I can take advantage of the column storage 
>> indexing as we are logging a large amount of data.
>>
>> The issue I am facing is that MSSQL boolean datatypes (which translate to 
>> a bit in the DB) are not evaluating to True or False when retrieved from 
>> the DB.
>>
>> The table itself will show a bit value of 1 or 0 however any boolean test 
>> will fail.
>>
>> At this point I am going to have to define a string value and evaluate 
>> the value as str("True") or False which seems like a poor workaround.  Has 
>> anyone else seen this issue or found a resolution?
>>
>> I have tried 2 configurations:
>> 1. Red Hat Enterprise 6 with pyodbc and the Microsoft driver installed (a 
>> pain as you have to hack it to work with Web2py)
>> and 
>> 2. Windows Server 2008 R2 with pyodbc, python utils and the Windows SDK 
>> comand "C:\Program Files\Microsoft SDKs\Windows\v6.1\Bin\mt.exe" 
>> -inputresource:c:\
>> windows\syswow64\python27.dll;#2 
>> -outputresource:C:\Python27\Lib\site-packages\p
>> yodbc.pyd;#2
>>
>> Both setups were somewhat painful but result in an operating web2py 
>> setup.  If the setup itself is incorrect would love feedback.
>>
>> Appreciate any help - this is an important project, green, high-profile, 
>> and large-scale but hinges on the ability to run MSSQL.
>>
>>
>
> Are you aware of the fact that the boolean datatype in Web2py translates 
> to 'T' or 'F' (Char[1])  in the backend datatype? 
>
> Example:
>
>  Field("sadc", "boolean", default = False),  
>
> in DAL translates into 
>
>  sadc character(1),  
>
> in Postgresql.
>
> See https://groups.google.com/forum/?fromgroups#!topic/web2py/qwFYJb6k7bQfor 
> one of the discussions about it.
>
>
>
> Regards
> Johann 
>
>
>
> -- 
> Because experiencing your loyal love is better than life itself, 
> my lips will praise you.  (Psalm 63:3)
>
>

Reply via email to