[fpc-pascal] GetTableNames in TSQLConnection / Postgresql

michael.vancanneyt at wisa.be michael.vancanneyt at wisa.be
Mon Dec 17 12:21:00 CET 2012



On Mon, 17 Dec 2012, Ludo Brands wrote:

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

Well, if you don't need the concatenation, presumably you don't need the quotes :-)

I thought the schema query is connection dependent ?

In that case, there is no need for this option, as the connection will apply
the quotes as needed ?

Michael.



More information about the fpc-pascal mailing list