[fpc-pascal] SQLDB GetSchemaInfoSQL for indexes etc?

Reinier Olislagers reinierolislagers at gmail.com
Tue Apr 17 10:36:15 CEST 2012


In sqldb, this:

type TSchemaType = (stNoSchema, stTables, stSysTables, stProcedures,
stColumns, stProcedureParams, stIndexes, stPackages);
is used in the GetSchemaInfoSQL function:

I noticed stIndexes, stProcedureParams and stPackages do not seem to be
used in the current sqldb connectors in packages\fcl-db\src\sqldb\ and
below.

The others are used in GetSchemaInfoSQL to get an SQL command that
returns the names of the objects (tables etc): e.g. tables:
Firebird:
s := 'select '+
                          'rdb$relation_id          as recno, '+
                          '''' + DatabaseName + ''' as catalog_name, '+
                          '''''                     as schema_name, '+
                          'rdb$relation_name        as table_name, '+
                          '0                        as table_type '+
                        'from '+
                          'rdb$relations '+
                        'where '+
                          '(rdb$system_flag = 0 or rdb$system_flag is
null) ' + // and rdb$view_blr is null
                        'order by rdb$relation_name';
MS SQL Server:
Result := format(SCHEMA_QUERY, ['table_name','U']);

Does anybody know what stIndexes, stProcedureParams and stPackages
should return and when they would be used?

What happens e.g. with indexes - that IIRC can have unique names per
database (Firebird,...) or per table (MS SQL Server,...)?

I am trying to see if having a list of indexes in the database
connectors would help with the data dictionary
(packages\fcl-db\src\datadict)...

Thanks,
Reinier



More information about the fpc-pascal mailing list