Subject | Re: TIB_Query.Prepare vs. TIBOQuery.Prepare |
---|---|
Author | scyre9 |
Post date | 2006-11-06T10:24:48Z |
Hi everyone!
First of all, thanks for the reactions! :)
Now that I was forced to reproduce the phenomenon, I finally found the reason myself: Calling TIBOQuery.Prepare does a lot of extra work, i.e. it collects metadata (procedure names, primary key fields, computed columns, default field sources). In a database with tons of objects, this takes a while...
The solution: TIB_SchemaCache!
So I set the property TIBODataBase.SchemaCacheDir to a local directory, and in TIBODataBase.AfterConnect I do somethig like this:
IBODatabase1.SchemaCacheDir := TempPath;
IBODatabase1.FlushSchemaCache;
IBODatabase1.SchemaCache.Computed;
IBODatabase1.SchemaCache.ConstraintNames;
IBODatabase1.SchemaCache.Defaults;
IBODatabase1.SchemaCache.DomainNames;
IBODatabase1.SchemaCache.ForeignKeys;
IBODatabase1.SchemaCache.GeneratorNames;
IBODatabase1.SchemaCache.IndexDefs;
IBODatabase1.SchemaCache.IndexNames;
IBODatabase1.SchemaCache.PrimaryKeys;
IBODatabase1.SchemaCache.ProcedureNames;
IBODatabase1.SchemaCache.Required;
IBODatabase1.SchemaCache.TableNames;
IBODatabase1.SchemaCache.RelationsByID;
IBODatabase1.SchemaCache.TriggerNames;
IBODatabase1.SchemaCache.ViewNames;
IBODatabase1.SchemaCache.FieldDomains;
IBODatabase1.SchemaCache.TableKeys;
IBODatabase1.SchemaCache.TableFields;
IBODatabase1.SchemaCache.ProcedureParams;
(I'd prefer a single call of TIB_SchemaCache.GetSchemaCacheList, but it's not public.)
It takes a little longer to establish the connection, but now everything works fine! :)
Greetings
Thomas
First of all, thanks for the reactions! :)
Now that I was forced to reproduce the phenomenon, I finally found the reason myself: Calling TIBOQuery.Prepare does a lot of extra work, i.e. it collects metadata (procedure names, primary key fields, computed columns, default field sources). In a database with tons of objects, this takes a while...
The solution: TIB_SchemaCache!
So I set the property TIBODataBase.SchemaCacheDir to a local directory, and in TIBODataBase.AfterConnect I do somethig like this:
IBODatabase1.SchemaCacheDir := TempPath;
IBODatabase1.FlushSchemaCache;
IBODatabase1.SchemaCache.Computed;
IBODatabase1.SchemaCache.ConstraintNames;
IBODatabase1.SchemaCache.Defaults;
IBODatabase1.SchemaCache.DomainNames;
IBODatabase1.SchemaCache.ForeignKeys;
IBODatabase1.SchemaCache.GeneratorNames;
IBODatabase1.SchemaCache.IndexDefs;
IBODatabase1.SchemaCache.IndexNames;
IBODatabase1.SchemaCache.PrimaryKeys;
IBODatabase1.SchemaCache.ProcedureNames;
IBODatabase1.SchemaCache.Required;
IBODatabase1.SchemaCache.TableNames;
IBODatabase1.SchemaCache.RelationsByID;
IBODatabase1.SchemaCache.TriggerNames;
IBODatabase1.SchemaCache.ViewNames;
IBODatabase1.SchemaCache.FieldDomains;
IBODatabase1.SchemaCache.TableKeys;
IBODatabase1.SchemaCache.TableFields;
IBODatabase1.SchemaCache.ProcedureParams;
(I'd prefer a single call of TIB_SchemaCache.GetSchemaCacheList, but it's not public.)
It takes a little longer to establish the connection, but now everything works fine! :)
Greetings
Thomas