Subject | Re: [firebird-support] Stored Procedure Creator Problem |
---|---|
Author | Ivan Prenosil |
Post date | 2004-12-29T19:35:47Z |
> But that I know. Sorry, I think I've been a little not direct onI have not read original message thoroughly,
> what I want here. Look, I need a table so I can make this "translation".
>
> For example, I know that LONG(4) is the INTEGER in Firebird. But
> what is Int64 (8,-4) just to be in one example only?
>
> I would like this table of translation so I can convert the types I
> get with the SQL String to put it in my code.
but I still think you do not "need" any translation table.
Can you try this CASE expression:
CASE
WHEN RDB$FIELD_TYPE=14 THEN 'CHAR(' || RDB$CHARACTER_LENGTH || ') '
WHEN RDB$FIELD_TYPE=37 THEN 'VARCHAR(' || RDB$CHARACTER_LENGTH || ') '
WHEN RDB$FIELD_TYPE IN (7,8,16) AND RDB$FIELD_SUB_TYPE=1 THEN 'NUMERIC(' || RDB$FIELD_PRECISION || ',' ||
(-RDB$FIELD_SCALE) || ')'
WHEN RDB$FIELD_TYPE IN (7,8,16) AND RDB$FIELD_SUB_TYPE=2 THEN 'DECIMAL(' || RDB$FIELD_PRECISION || ',' ||
(-RDB$FIELD_SCALE) || ')'
WHEN RDB$FIELD_TYPE IN (7,8,16) THEN
CASE RDB$FIELD_TYPE WHEN 7 THEN 'SMALLINT' WHEN 8 THEN 'INTEGER' WHEN 16 THEN 'BIGINT' ELSE '#' END
WHEN RDB$FIELD_TYPE=10 THEN 'FLOAT'
WHEN RDB$FIELD_TYPE=27 THEN 'DOUBLE PRECISION'
WHEN RDB$FIELD_TYPE=12 THEN 'DATE'
WHEN RDB$FIELD_TYPE=13 THEN 'TIME'
WHEN RDB$FIELD_TYPE=35 THEN 'TIMESTAMP'
WHEN RDB$FIELD_TYPE=261 THEN 'BLOB SUB_TYPE ' ||
CASE RDB$FIELD_SUB_TYPE WHEN 0 THEN 'BINARY' WHEN 1 THEN 'TEXT' ELSE RDB$FIELD_SUB_TYPE END
ELSE '??'
END
Ivan
http://www.volny.cz/iprenosil/interbase/