Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    MySQL boolean type

    Hi Isomorphic,

    As MySQL (prior to ver 5.5) doesn't have BOOLEAN datatype, I have used TINYINT (1) in my client-server applications for almost 10 years now.
    I tried smartclient ver 11 and couldn't find any control that can work perfectly with TINYINT (1) field type, I tried editorType="checkbox", it doesn't work with datasource type="boolean" and sqlStorageStrategy="SingleChar10" and when I change the datatype="integer", and tried to save the record, the control complained that it should be whole number. the same when I tried valueMap with 0 mapped to false and 1 mapped to true.
    I did manage to get it work when I change editorType="comboBox" with valueMap, but I have to change the value of the boolean field before saving (If I wanted to keep the save value, I had to change it to other value and then change it back), the same error occured when I tried to save the record directly without changing it first.

    Did I overlook something or smartclient wont work with TINYINT (1) used to store boolean field?

    Thank you,
    Boen, TP,

    #2
    After may times of trial and error, I have found that with datasource type="boolean" and sqlStorageStrategy="integer" everything works fine.
    It's a pity that this was not documented.

    Comment


      #3
      Hello, it's documented, see https://www.smartclient.com/smartgwt...torageStrategy
      Code:
       
       public java.lang.String sqlStorageStrategy  For certain field types, indicates the strategy to be used to store values to the underlying SQL column. [B]Fields of type "boolean"[/B]
      The default strategy for boolean fields is to assume the underlying type of the field is text and store boolean true and false values as the character strings "true" and "false". The following additional strategies are available:[LIST][*]"number" or "integer": store true as 1, false as 0[/LIST]

      Comment


        #4
        Hi boentp,

        it is "singleChar10", not "SingleChar10". Also, it is documented, as written above.

        Best regards
        Blama

        Comment


          #5
          Dear claudiobosticco and Blama,
          Thank you for pinpointing the doc.

          Comment

          Working...
          X