Page 1 of 1

revDatabaseColumnIsNull not working properly ??

Posted: Sun Jul 27, 2008 6:54 pm
by xeir
Wondering if anyone has run across a problem with Rev 2.9 where the function revDatabaseColumnIsNull reports empty non nullable database fields as null?

I'm using MySQL for the database and the 2.9 Database drivers in Revolution.

Here's the structure for the related fields:

Code: Select all

Field         Type          Collation    Attributes   Null   Default	
prodAbbr  varchar(6)  latin1_swedish_ci               No
prodUsed  tinyint(3)                     UNSIGNED     Yes    NULL
I'm using the snippet that has already been found in the forums:

Code: Select all

put "SELECT * FROM product LIMIT 3" into tSQL 
  put revQueryDatabase(tConnectionId, tSQL) into tResultSet 
  if tResultSet is not a number then 
    answer error tResultSet 
    exit mouseUp 
  end if 
  put revDatabaseColumnNames(tResultSet) & return into field "Test4"
  put revDatabaseColumnTypes(tResultSet) & return after field "Test4" 
  put revDatabaseColumnCount(tResultSet) into tColumnCount 
  repeat until revCurrentRecordIsLast(tResultSet) 
    repeat with tColumn = 1 to tColumnCount 
      if revDatabaseColumnIsNull(tResultSet, tColumn) then 
        put "null" after field "Test4" 
      else 
        put empty into tHolder 
        get revDatabaseColumnNumbered(tResultSet, tColumn, "tHolder") 
        put tHolder after field "Test4" 
      end if 
      put tab after field 2 
    end repeat 
    put return after field "Test4" 
    revMoveToNextRecord tResultSet 
  end repeat 
  revCloseCursor tResultSet
And here is the result:

Code: Select all

prodID,isCommon,prodAbbr,prodName,prodCost,prodUsed,prodEstimate
SMALLINT,SMALLINT,STRING,STRING,STRING,SMALLINT,FLOAT
10nullBLANK0.00null0.00
21TPTestProduct3.7800.00
The first instance of null is not a nullable field in the database, it is an empty string for the first record, while the second null is a nullable field.

I've searched the forums to no avail, so any insight into what is causing the problem would be most appreciated.

Thx

Posted: Mon Jul 28, 2008 6:29 am
by Janschenkel
I was able to simulate this behaviour - so please report it through the Revolution Quality Center http://quaility.runrev.com

Jan Schenkel.

Posted: Mon Jul 28, 2008 5:00 pm
by xeir
Thanks for testing the results, I have reported the issue as requested.