Results 1 to 2 of 2

Thread: boolean in SQL

  1. #1
    Join Date
    Jul 2003
    Posts
    4

    Thumbs down Unanswered: boolean in SQL

    I have finished application (Borland Builder C++) useing BDE and Paradox table. After all I wanted to change engine to other. It is MySQL + ODBC. Now there is no more suport for SQL statements like:
    "select * from TableName"
    "where record_saved = true"

    record_saved is ftBoolean type. MySQL returns error:
    >> true - invalid column name<<.

    ftBoolean is converted to TINYINT(1).
    How can I overcome this, and make my app to work with no big changes. Is there an interface I can modyfy 'false -> 0' 'true -> 1' ?

  2. #2
    Join Date
    Jun 2003
    Posts
    21

    Re: boolean in SQL

    Originally posted by swiatlo
    I have finished application (Borland Builder C++) useing BDE and Paradox table. After all I wanted to change engine to other. It is MySQL + ODBC. Now there is no more suport for SQL statements like:
    "select * from TableName"
    "where record_saved = true"

    record_saved is ftBoolean type. MySQL returns error:
    >> true - invalid column name<<.

    ftBoolean is converted to TINYINT(1).
    How can I overcome this, and make my app to work with no big changes. Is there an interface I can modyfy 'false -> 0' 'true -> 1' ?
    Use the ORD function (Delphi has it, I presume that C Builder also has it). It returns the ordinal value of a boolean being either 1 for TRUE or 0 for FALSE.

    "select * from TableName"
    "where record_saved = " + IntToStr(Ord(true))

    Hope this helps.

    Niels

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •