[fpc-pascal] SQLDB GetSchemaInfoSQL for indexes etc?

michael.vancanneyt at wisa.be michael.vancanneyt at wisa.be
Tue Apr 17 10:41:42 CEST 2012



On Tue, 17 Apr 2012, Reinier Olislagers wrote:

> 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?

stIndexes: get a list of indexes from a table.
stPRocedureParams: get the parameters of a stored procedure
stPackages: list packages (Oracle and Firebird)

>
> 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)...

It would help, yes.

Michael.



More information about the fpc-pascal mailing list