开发者

PowerBuilder 12 and SQL bit data type problem (1 misread as -1)

I have a PB 12 app that uses SNC to connect to a SQL 2008 DB. I have a table with bit data types that are filled in with 1s and 0s, as you would expect. When PB queries this table it converts all 1s to -1s. This is new behavior after开发者_运维知识库 we converted an old PB 9 app to 12, also switching our DB provider from OLEDB to SNC (SQL Native Client).

Digging around the web I see that this issue was reported back in PB 11 and that the only solution was to set a DBParm parameter to a legacy value that negatively impacts performance. (DBParm 'StaticBind' set to 0 instead of the default of 1).

Has there been any work done on this bug since then? How have folks addressed this issue?

Thanks!


Most definitions of boolean data types (often represented as bit types in sql) state that 0 is false and non-zero is true. So in boolean terms -1 and +1 are broadly equivalent.

In some languages, the Boolean data type is defined to include more than two truth values. For instance the ISO SQL 1999 standard defined a Boolean value as being either true, false, or unknown (SQL null).

It could be that the -1 is returned in the query it is because PowerBuilder is interpreting the result as 'unknown' rather than 'true'.

So you should evaluate whether or not the value is 0 (false) and if not its true.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜