This is exactly why I stopped using Booleans in SQlite and REAL SQL dbs

Consider defining it as an integer, 0 = no/false 1 = yes/true
You get the added benefit of a very portable db model. SQLite, with it's silly manifest typing, can bite you if you move to a different backend.

For me, integers work great for very little extra work.


At 8:43 AM -0500 5/9/06, Dobbs, Paul wrote:
Same result.


Paul Dobbs
Software Engineer, Staff
Lockheed Martin Missiles and Fire Control
Phone (972) 603-1244
Fax (972) 603-2017

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Marco
Bambini
Sent: Tuesday, September 05, 2006 8:16 AM
To: REALbasic NUG
Subject: Re: Database problem

Try this:

... where active = 'True'

---
Marco Bambini
http://www.sqlabs.net
http://www.sqlabs.net/blog/



On Sep 5, 2006, at 3:10 PM, Dobbs, Paul wrote:

 I have a database program which I created some time back to track
 access to a secure area. The program (last compiled in April) has
 developed a problem in that it will not add new records. All other
 operations work fine. When I trie to run the program in the IDE so
 that I can look at the problem, it will load the database.

 The problem occurs in the following code:
   RS = DB.SQLSelect("select fname, lname, empno from people where
 active = 'true' order by lname, fname")
   If DB.Error Then
     ReportError "Error while getting names: " + DB.ErrorMessage, Error
   Else
     While Not RS.EOF
       Names.Append RS.Field("fname").StringValue + " " +
 RS.Field("lname").StringValue
       EmpNos.Append RS.Field("empno").IntegerValue
       RS.MoveNext
     Wend
   End If

 I always get the "Error while getting names" message.

 I found the following in the release notes for RB2006 R2:

 BooleanColumn (in RecordSets and DatabaseRecords) now write a '1' for
 true and a '0' for false into table fields.
 Before they wrote the strings 'true' and 'false

 And the following in the release notes for R3:
 REAL SQL Database: Boolean fields are now more pedantic about what
 they expect when using DatabaseField. BooleanValue. Previously, '0'
 and 'false' were treated as False and anything else was treated as
 True.
 Now, '0' and 'false' are treated as False and '1' and 'true' are
 treated as True. The behavior of any other values is undefined if
 retrieved using DatabaseField.BooleanValue. DatabaseField.StringValue,

 on the other hand, should be able to retrieve the original data if it
 can't be identified as a boolean. If the REAL SQL Database can
 identify the value as a boolean, however, then False will always
 return 'false' and True will always return 'true', regardless of how
 those values are stored in the database. This is a side effect of the
 way in which database engines interact with the database API in the
 REALbasic framework. Note that the change to
 DatabaseField.BooleanValue should only be an issue if you are trying
 to store non-boolean data in a boolean column.

 Neither seems to tell me just how to fix my problem. I have tried
 "where active = 1", "where active = '1'" and "where active" and all
 give the same results as "where active = 'true'". How can I fix this
 problem so that I can go looking for the original problem?

 Paul Dobbs
 Software Engineer, Staff
 Lockheed Martin Missiles and Fire Control Phone (972) 603-1244 Fax
 (972) 603-2017

 _______________________________________________
 Unsubscribe or switch delivery mode:
 <http://www.realsoftware.com/support/listmanager/>

 Search the archives of this list here:
 <http://support.realsoftware.com/listarchives/lists.html>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>


--

Cheers,

Dr Gerard Hammond
MacSOS Solutions
http://www.macsos.com.au
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to