Zeos Metadata
Moderators: gto, cipto_kh, EgonHugeist, mdaems
-
- Expert Boarder
- Posts: 158
- Joined: 06.11.2005, 01:43
Zeos Metadata
Hi
I am attaching following files which I have changed to get the metadata information. The changes are mostly to Firebird/Interbase unit. There are other changes to TZSQLMetadata component.
This is still work in progress but I hope to get as much information for as many databases engines as I can.
I would like someone to just keep an eye and advice me if I am doing something wrong.
Regards
Sandeep
Edit by mdaems : patch removed.
I am attaching following files which I have changed to get the metadata information. The changes are mostly to Firebird/Interbase unit. There are other changes to TZSQLMetadata component.
This is still work in progress but I hope to get as much information for as many databases engines as I can.
I would like someone to just keep an eye and advice me if I am doing something wrong.
Regards
Sandeep
Edit by mdaems : patch removed.
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
This is an ambitious one... Maybe we had better done this step by step.
Did you think about behaviour when IncludeSources was false at cache creation and 'true' at next pass? I'm afraid we forgot about that... I'm not sure how we can fix it. Maybe we'll have to dig into the cache behaviour.
A question : Did you try adding the parameter 'IncludeSources' by overloading the functions? I just tried if this is possible with interfaces and it looks like it is. D5+ and FPC2.2 compile. No idea if it really works, however. If it does we don't have to change the existing GetTable/Getxxx calls. Maybe a minor issue for the components, but there might be users using it directly.
Anyhow : I didn't test it yet, but it looks like good stuff... !!
Mark
Did you think about behaviour when IncludeSources was false at cache creation and 'true' at next pass? I'm afraid we forgot about that... I'm not sure how we can fix it. Maybe we'll have to dig into the cache behaviour.
A question : Did you try adding the parameter 'IncludeSources' by overloading the functions? I just tried if this is possible with interfaces and it looks like it is. D5+ and FPC2.2 compile. No idea if it really works, however. If it does we don't have to change the existing GetTable/Getxxx calls. Maybe a minor issue for the components, but there might be users using it directly.
Anyhow : I didn't test it yet, but it looks like good stuff... !!
Mark
-
- Expert Boarder
- Posts: 158
- Joined: 06.11.2005, 01:43
The sources will not be fetched if IncludeSources is set to false in first pass and then to true after that. To re-fetch the source we could call ClearCache(not sure if this is the exact name of the method but there is something as I am using it) when IncludeSource is set to True or False.
I haven't added any overloaded methods but I have added another parameter to the methods where I needed and I am passing False (IncludeSources) everywhere, so sources are not fetched by default.
There are also some changes to the SQL in GetTables for Firebird. It was getting duplicate records for Views.
Would it possible for you or anyone to run the unit tests (with the changes) and make sure everything is fine?
Sandeep
I haven't added any overloaded methods but I have added another parameter to the methods where I needed and I am passing False (IncludeSources) everywhere, so sources are not fetched by default.
There are also some changes to the SQL in GetTables for Firebird. It was getting duplicate records for Views.
Would it possible for you or anyone to run the unit tests (with the changes) and make sure everything is fine?
Sandeep
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
Hi,
I did run the tests against firebird (embedded) and some mysql versions.
I had to change the test sources for the new parameters. Please try using overloads to avoid this. (if your tries fail we'll have to live with it, however)
The logs are attached. I didn't really check them. All differences are situated in the dbc part. Probably the tests are wrong now. Can you check?
Mark
I did run the tests against firebird (embedded) and some mysql versions.
I had to change the test sources for the new parameters. Please try using overloads to avoid this. (if your tries fail we'll have to live with it, however)
The logs are attached. I didn't really check them. All differences are situated in the dbc part. Probably the tests are wrong now. Can you check?
Mark
You do not have the required permissions to view the files attached to this post.
-
- Expert Boarder
- Posts: 158
- Joined: 06.11.2005, 01:43
Hi Mark
I think you are right I should have used overloaded methods but on second thought I think it might be alright to just change the parameters as adding a new method would require a recompile of all the ZBPLs so would adding a new parameter. If you still think an overloaded method is the way to go then I could spend sometime adding a overloaded method.
Regards
Sandeep
I think you are right I should have used overloaded methods but on second thought I think it might be alright to just change the parameters as adding a new method would require a recompile of all the ZBPLs so would adding a new parameter. If you still think an overloaded method is the way to go then I could spend sometime adding a overloaded method.
Regards
Sandeep
-
- Expert Boarder
- Posts: 158
- Joined: 06.11.2005, 01:43
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
Try overloading, please. That way we don't have to change anything existing unless we need the new functionallity. Compiling all packages we have to do anyway.
And the coding difference is limited to the Abstract class. There the method with the old parameters just refers to the same method with the new parameters. So no double coding
And the coding difference is limited to the Abstract class. There the method with the old parameters just refers to the same method with the new parameters. So no double coding
-
- Expert Boarder
- Posts: 158
- Joined: 06.11.2005, 01:43
Correct me if I am wrong but if I add overloaded method I would have to move the code from method without IncludeSources parameter to the one which has IncludeSources, as we want to keep the code in one place.
This means if I use GetTables with IncludeSources in TZSQLMetadata I would have to implement 2 methods with and without IncludeSources parameter in all Z[DATABASE]Metadata files as there are other places where the method without IncludeSources is called.
This is right isn't it?
Regards
Sandeep
This means if I use GetTables with IncludeSources in TZSQLMetadata I would have to implement 2 methods with and without IncludeSources parameter in all Z[DATABASE]Metadata files as there are other places where the method without IncludeSources is called.
This is right isn't it?
Regards
Sandeep
-
- Expert Boarder
- Posts: 158
- Joined: 06.11.2005, 01:43
-
- Expert Boarder
- Posts: 158
- Joined: 06.11.2005, 01:43
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
I just tried to build the sources you posted. The automatic build scripts did not show any compilation problem. I'm having trouble with the tests suite, however. Loads of AV messages. For Mysql tests and also for Firebird tests. So I'll need to investigate that further.
Concerning the constraints question. Why only check constraints? Why not "not null" constraints and "FK constraints" or what other types of constraints do exist. Or are they already available in another metadata type?
Oh... Just checked information_schema on Wikipedia. Seems like fk and check constraints are usually treated seperately. And null constraints are part of the column definitions.
Conclusion: mdCheckConstraints seems logical.
Mark
Concerning the constraints question. Why only check constraints? Why not "not null" constraints and "FK constraints" or what other types of constraints do exist. Or are they already available in another metadata type?
Oh... Just checked information_schema on Wikipedia. Seems like fk and check constraints are usually treated seperately. And null constraints are part of the column definitions.
Conclusion: mdCheckConstraints seems logical.
Mark
Last edited by mdaems on 10.03.2008, 00:21, edited 1 time in total.
- mdaems
- Zeos Project Manager
- Posts: 2766
- Joined: 20.09.2005, 15:28
- Location: Brussels, Belgium
- Contact:
I started doing some research...
First problem looks like this:
This should be
Second remark : You didn't have to override GetTables and GetProcedures twice for every implementation.
In every ZDbcXXXXMetadata.pas unit you only had to change the old parameter sets to the new ones. The translation from 'old' to 'new' parameter layout will be done here for all databases at once:
I attach the corrected files.
First problem looks like this:
Code: Select all
function TZAdoDatabaseMetadata.GetProcedures(const Catalog: string;
const SchemaPattern: string; const ProcedureNamePattern: string): IZResultSet;
begin
GetProcedures(Catalog, SchemaPattern, ProcedureNamePattern, False);
end;
Code: Select all
function TZAdoDatabaseMetadata.GetProcedures(const Catalog: string;
const SchemaPattern: string; const ProcedureNamePattern: string): IZResultSet;
begin
result := GetProcedures(Catalog, SchemaPattern, ProcedureNamePattern, False);
end;
In every ZDbcXXXXMetadata.pas unit you only had to change the old parameter sets to the new ones. The translation from 'old' to 'new' parameter layout will be done here for all databases at once:
Code: Select all
function TZAbstractDatabaseMetadata.GetProcedures(const Catalog, SchemaPattern,
ProcedureNamePattern: string): IZResultSet;
begin
result := GetProcedures(Catalog, SchemaPattern, ProcedureNamePattern, False);
end;
function TZAbstractDatabaseMetadata.GetTables(const Catalog, SchemaPattern,
TableNamePattern: string; const Types: TStringDynArray): IZResultSet;
begin
result := GetTables(Catalog, SchemaPattern, TableNamePattern, Types, False);
end;
You do not have the required permissions to view the files attached to this post.
-
- Expert Boarder
- Posts: 158
- Joined: 06.11.2005, 01:43