[fpc-pascal] Database Metadata proposal

Michael Van Canneyt michael at freepascal.org
Mon Jun 2 15:38:37 CEST 2014



On Mon, 2 Jun 2014, LacaK wrote:

> Daniel Gaspary  wrote / napísal(a):
> 
> On Mon, Jun 2, 2014 at 3:01 AM, LacaK <lacak at zoznam.sk> wrote:
> 
> 
> IMO very similar result you can get also with existing implementation, when
> you use:
> 
> 
> Yes, this is the way GetDBInfo do, but it's not public, and never
> return schema. 
> 
> Code which I have attached uses only public methods and returns "metadata dataset" which has also schema_name column
> (for SQLConnection which support schemas. I have used public method SetSchemaInfo not GetDBInfo)
> 
> What I did was to copy and modify this method.
> 
> I have sent a patch: http://bugs.freepascal.org/view.php?id=26254
> 
> 
> Yes I see it, but as I wrote your new method returns collection, which you must process, which is more or less what you can do with "metadata dataset"

While this is correct, the collection approach is much easier to use:
With the metadataset, you must know which fields exist and type them correctly: 
FieldByName('XYZ').AsString

With collections, the IDE codetools will tell you what properties exist.
That is a order of magnitude more comfortable and less error prone.

Michael.


More information about the fpc-pascal mailing list