[fpc-pascal] GetTableNames in TSQLConnection / Postgresql
Ludo Brands
ludo.brands at free.fr
Mon Dec 17 11:24:44 CET 2012
On 17/12/2012 10:45, michael.vancanneyt at wisa.be wrote:
>
>
> On Mon, 17 Dec 2012, LacaK wrote:
>
>>
>> Yes. May be, that I was not clear. My suggestion was 3+ fields in query:
>> SCHEMA_NAME, TABLE_NAME, SCHEMA_TABLE_NAME (SCHEMA_NAME || '.' ||
>> TABLE_NAME)
>>
>> But original question AFAIU was about: what should GetTableNames
>> return (schema query can return multiple columns, but what column use
>> when fill list of table names)?
>> GetTableNames return list of table names into TStrings.
>> Now only TABLE_NAME is returned. John requested, that also schema
>> name should be prefixed (if there is any)
>
> Ah, that was not clear to me :-)
>
> But why the SCHEMA_TABLE_NAME ? It's redundant information, as the
> information is present in SCHEMA_NAME and TABLE_NAME anyway ?
>
> If you need the schema name, why not just access the SCHEMA_NAME field ?
>
> A different story is the GetTableNames call, which will - presumably -
> use
> the above information.
>
> There I think some extra options are needed:
>
> TSchemaOption = (soPrependSchemaName,soIncludeSystemObjects);
> TSchemaOptions = set of TSchemaOption;
>
> Procedure GetTableNames(List : TStrings; Options : TSchemaOptions = []);
>
> I am not interested in schema information, but I can imagine some
> people are
> (the original poster, obviously). The above caters for everyone and keeps
> backwards compatibility.
The question is also why return SCHEMA_NAME || '.' || TABLE_NAME when
this is not always usable in a query later on ? One DB needs
"SCHEMA_NAME"."TABLE_NAME", another `SCHEMA_NAME`.`TABLE_NAME`.
An additional option soQuoteNames?
Ludo
More information about the fpc-pascal
mailing list