Subject | RE: [IBO] Converting from BDE - TSession |
---|---|
Author | Ben Daniel |
Post date | 2003-09-30T01:09:33Z |
Right so this 'bde replacement' doesn't actually have a global session variable like the bde - it's private and the only way to access it is to create a TIBOComponent decendant and access it's IB_Session property. Um, can you say 'Cop out'?
Let me give you an example of where I use session.
I use it to get a reference to the database where I only know the database name. E.g.
TMyObject = class
published
...
property DatabaseName: string read FDatabaseName write FDatabaseName;
...
end;
...
procedure TMyObject.Commit;
var DB: TDatabase;
begin
DB := Session.FindDatabase(FDatabaseName);
DB.Commit;
end;
So you are saying to do the above in IBO I would have to do this:
procedure TMyObject.Commit;
function GetGlobalSessionThatIBODoesntExpose: TIB_Session;
begin
with TIBOQuery.Create(nil) do
try
Result := IB_Session
finally
Free;
end;
end;
var DB: TIBODatabase;
begin
DB := TIBODatabase(GetGlobalSessionThatIBODoesntExpose.GetConnectionByName(FDatabaseName));
DB.Commit;
end;
That's ok, I can handle that, but I still think that it's a cop out if the only way to access the **global** default ibo session is through the **property** of an ibocomponent when this is supposed to be a bde replacement. Oh well, life goes on.
Thanks for all your help.
Ben
-----Original Message-----
From: Helen Borrie [mailto:helebor@...]
Sent: Tuesday, 30 September 2003 9:47 AM
To: IBObjects@yahoogroups.com
Subject: RE: [IBO] Converting from BDE - TSession
At 09:22 AM 30/09/2003 +1000, you wrote:
of all IB components. A TIBODatabase object **is** an IBO component. The
TIBODataset component exposes this property to its descendants explicitly
through the TIB_ wrapper. Read the property list in the Help.
YourIBODatabase.IB_Session.GetConnectionByName
Maybe I've lost track of this thread, but why can't you just read the
DatabaseName property of the IBODatabase?
Helen
___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Let me give you an example of where I use session.
I use it to get a reference to the database where I only know the database name. E.g.
TMyObject = class
published
...
property DatabaseName: string read FDatabaseName write FDatabaseName;
...
end;
...
procedure TMyObject.Commit;
var DB: TDatabase;
begin
DB := Session.FindDatabase(FDatabaseName);
DB.Commit;
end;
So you are saying to do the above in IBO I would have to do this:
procedure TMyObject.Commit;
function GetGlobalSessionThatIBODoesntExpose: TIB_Session;
begin
with TIBOQuery.Create(nil) do
try
Result := IB_Session
finally
Free;
end;
end;
var DB: TIBODatabase;
begin
DB := TIBODatabase(GetGlobalSessionThatIBODoesntExpose.GetConnectionByName(FDatabaseName));
DB.Commit;
end;
That's ok, I can handle that, but I still think that it's a cop out if the only way to access the **global** default ibo session is through the **property** of an ibocomponent when this is supposed to be a bde replacement. Oh well, life goes on.
Thanks for all your help.
Ben
-----Original Message-----
From: Helen Borrie [mailto:helebor@...]
Sent: Tuesday, 30 September 2003 9:47 AM
To: IBObjects@yahoogroups.com
Subject: RE: [IBO] Converting from BDE - TSession
At 09:22 AM 30/09/2003 +1000, you wrote:
>Hi Nando,It's common enough but it's generally pretty obvious.
>
>I mustn't be too good at searching the archives as I've searched through
>them and found nothing of any help.
>I am beginning to wonder if this question has actually been asked at all.
>Thanks for your suggestion but I have already been down your path.Read Artur's advice again. "IB_Session" **is** the global session property
>I have come across TIB_Session.GetConnectionByName but finding a global
>(or default) session variable is obviously the key. Unfortunately the
>IB_Session identifier isn't a variable, it is a unit. And there is no
>IB_Session.Session or IB_Session.IB_Session global variable!
of all IB components. A TIBODatabase object **is** an IBO component. The
TIBODataset component exposes this property to its descendants explicitly
through the TIB_ wrapper. Read the property list in the Help.
>Surely someone else has had this problem before too? I just want to get aYourIBODataset.IB_Session.GetConnectionByName
>reference to a database by it's name.
YourIBODatabase.IB_Session.GetConnectionByName
Maybe I've lost track of this thread, but why can't you just read the
DatabaseName property of the IBODatabase?
Helen
___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/