Einzelnen Beitrag anzeigen

jobo

Registriert seit: 29. Nov 2010
3.072 Beiträge
 
Delphi 2010 Enterprise
 
#39

AW: Kleines Tool: SQL-Table to Class

  Alt 15. Sep 2018, 09:55
Firbird types von alterton.info
Code:
 SELECT r.rdb$field_name           AS field_name,
       r.rdb$description          AS field_description,
       r.rdb$default_value        AS field_default_value,
       r.rdb$null_flag            AS field_not_null_constraint,
       f.rdb$field_length         AS field_length,
       f.rdb$field_precision      AS field_precision,
       f.rdb$field_scale          AS field_scale,
       CASE f.rdb$field_type
         WHEN 261 THEN 'BLOB'
         WHEN 14 THEN 'CHAR'
         WHEN 40 THEN 'CSTRING'
         WHEN 11 THEN 'D_FLOAT'
         WHEN 27 THEN 'DOUBLE'
         WHEN 10 THEN 'FLOAT'
         WHEN 16 THEN 'INT64'
         WHEN 8 THEN 'INTEGER'
         WHEN 9 THEN 'QUAD'
         WHEN 7 THEN 'SMALLINT'
         WHEN 12 THEN 'DATE'
         WHEN 13 THEN 'TIME'
         WHEN 35 THEN 'TIMESTAMP'
         WHEN 37 THEN 'VARCHAR'
         ELSE 'UNKNOWN'
       END                        AS field_type,
       f.rdb$field_sub_type       AS field_subtype,
       coll.rdb$collation_name    AS field_collation,
       cset.rdb$character_set_name AS field_charset
FROM  rdb$relation_fields r
       LEFT JOIN rdb$fields f
              ON r.rdb$field_source = f.rdb$field_name
       LEFT JOIN rdb$collations coll
              ON f.rdb$collation_id = coll.rdb$collation_id
       LEFT JOIN rdb$character_sets cset
              ON f.rdb$character_set_id = cset.rdb$character_set_id
WHERE r.rdb$relation_name = 'TEST2' -- table name
ORDER BY r.rdb$field_position;
Gruß, Jo

Geändert von jobo (15. Sep 2018 um 10:45 Uhr)
  Mit Zitat antworten Zitat