[Gambas-devel] makefile !!!

PV oreip at ...1...
Tue Oct 11 12:09:09 CEST 2005


Hi Daniel,

On 10/10/2005 23:41, Daniel wrote:

> ok, this is for the 1.9.20

I've found a small problem in the firebird component regarding retrieving field 
names in a table.

If I tried

   DIM c AS NEW Connection
   DIM hTables AS Object
   DIM hFields AS Object

   WITH c
     .Type = "firebird"
     .Host = "localhost"
     .Name = "/my/path/to/database.gdb"
     .Login = "blabla"
     .Password = "blabla"
   END WITH

   c.Open

   FOR EACH hTables IN c.Tables
     IF NOT (Left(hTables.Name, 4) = "RDB$") THEN
       PRINT "Table: " & hTables.Name
       FOR EACH hFields IN hTables.Fields
         PRINT hFields.Name
       NEXT
     END IF
   NEXT

the program died unexpectedly raising the famous signal #6.

After a little investigation, I found out that the problem was on line 1690 of 
main.cpp

In fact, the problem occurred with a field like this
CREATE TABLE test (
DATA date default 'now',
...
);

so I changed the query in line 1690 from "select *" to "select rdb$field_name" 
and the problem disappeared.

Since the actual data returned by the query doesn't seem to matter (it's just 
the number of returned rows that counts and doing a "select *" seems a bit 
overkill), changing the query this way shouldn't do any harm.

I haven't investigated too deep to see where the actual fault comes up but I 
made a guess.

 From isql, doing a select like

select * from rdb$relation_fields where rdb$relation_name='TEST';

gives (on a date field without default value) a result like

RDB$FIELD_NAME                  DATA
RDB$RELATION_NAME               TEST
RDB$FIELD_SOURCE                RDB$2
RDB$QUERY_NAME                  <null>
RDB$BASE_FIELD                  <null>
RDB$EDIT_STRING                 <null>
RDB$FIELD_POSITION              1
RDB$QUERY_HEADER                <null>
RDB$UPDATE_FLAG                 1
RDB$FIELD_ID                    1
RDB$VIEW_CONTEXT                <null>
RDB$DESCRIPTION                 <null>
RDB$DEFAULT_VALUE               <null>
RDB$SYSTEM_FLAG                 0
RDB$SECURITY_CLASS              <null>
RDB$COMPLEX_NAME                <null>
RDB$NULL_FLAG                   <null>
RDB$DEFAULT_SOURCE              <null>
RDB$COLLATION_ID                <null>

and no crash whereas on a date field with default value I get

RDB$FIELD_NAME                  DATA2
RDB$RELATION_NAME               TEST
RDB$FIELD_SOURCE                RDB$3
RDB$QUERY_NAME                  <null>
RDB$BASE_FIELD                  <null>
RDB$EDIT_STRING                 <null>
RDB$FIELD_POSITION              2
RDB$QUERY_HEADER                <null>
RDB$UPDATE_FLAG                 1
RDB$FIELD_ID                    2
RDB$VIEW_CONTEXT                <null>
RDB$DESCRIPTION                 <null>
RDB$DEFAULT_VALUE               5:5b2
BLOB display set to subtype 1. This BLOB: subtype = 2

RDB$SYSTEM_FLAG                 0
RDB$SECURITY_CLASS              <null>
RDB$COMPLEX_NAME                <null>
RDB$NULL_FLAG                   <null>
RDB$DEFAULT_SOURCE              5:5b3
default 'now'
RDB$COLLATION_ID                <null>

and a crash.

That BLOB line and the following empty one look suspicious to me and that is 
most likely the cause of the crash.

My guess seems to be confirmed by the fact that selecting only RDB$FIELD_NAME 
eliminates any problems.

I am using Firebird V1.5.1.4481, don't know if things have changed in other 
versions.


Ciao,
Piero









More information about the Devel mailing list