henryreynolds
asked on
Delphi6 Interbase Querys and Transactions handling
Good Day
I am new with Interbase/Firebird development, currently I am developing client server applications with Firebird using Interbase
components that are ship with Delphi 6 Enterprise.
I my plan is to develop small seperate .exe and then from a main menu application to
call each .exe as needed. The reason i am doing this is, If a problem occurs in a program then I can
quickly fix the program and the client are not affected in any way...I hope this is the best way..
Now my problem is as follows... In all my application I have a datamodule, in the datamodule
I got TIBDatabase component and a TIBtransaction component.
At this stage the properties of the tibtransaction are default.
My application do a normal select staments like this one.
with qryData do
begin
close;
sql.clear;
sql.add('select * from emp');
open;
end;
We I nedd to Update data, I call a stored procedure and all my code to update or insert are in the stored procedure.
NOW... my data doesnt refresh if I call my select statement, the old data still shows, but if I exit the app and re-run the application
the updated data are there.
Also If I run two seperate Instances of the same application on my pc, and i run a select and do a update, and i go to the
other exe and run the same select the updated data doesnt show...
HOW MUST I USE TRANSACTION, AND WHAT IS THE RIGHT WAY OF USING TRANSACTION, please i am desperate for help.
One more thing... I dont depend on dbnavigator to update or delete or to refresh data, I right my one select and use
stored procedures to insert/update data.
Thank you
Henry Reynolds
I am new with Interbase/Firebird development, currently I am developing client server applications with Firebird using Interbase
components that are ship with Delphi 6 Enterprise.
I my plan is to develop small seperate .exe and then from a main menu application to
call each .exe as needed. The reason i am doing this is, If a problem occurs in a program then I can
quickly fix the program and the client are not affected in any way...I hope this is the best way..
Now my problem is as follows... In all my application I have a datamodule, in the datamodule
I got TIBDatabase component and a TIBtransaction component.
At this stage the properties of the tibtransaction are default.
My application do a normal select staments like this one.
with qryData do
begin
close;
sql.clear;
sql.add('select * from emp');
open;
end;
We I nedd to Update data, I call a stored procedure and all my code to update or insert are in the stored procedure.
NOW... my data doesnt refresh if I call my select statement, the old data still shows, but if I exit the app and re-run the application
the updated data are there.
Also If I run two seperate Instances of the same application on my pc, and i run a select and do a update, and i go to the
other exe and run the same select the updated data doesnt show...
HOW MUST I USE TRANSACTION, AND WHAT IS THE RIGHT WAY OF USING TRANSACTION, please i am desperate for help.
One more thing... I dont depend on dbnavigator to update or delete or to refresh data, I right my one select and use
stored procedures to insert/update data.
Thank you
Henry Reynolds
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Direct Quote from Delphi 7 Help:-
"All TIBCustomDataSet descendants and TIBSQL need to use a transaction along with a database component to gain access to data in a database."
While you are getting used to this component the ibTransaction.params property can be left blank,
the system will apply a set of default params which should be suitable for most applications.
To reduce the posibility of deadlocks you can use the following structure
ibTransaction1.StartTransa ction;
ibQTable1.Insert;
ibQTable1.FieldByName('<Fi eldName>') .AsString := Edit1.Text;
ibQTable1.Post;
ibTransaction1.Commit; // end of transaction1
( or IBTransaction1.Rollback or IBTransaction1.RollbackRet aining if applicable)
Have a look at "Interbase Developers Guide" which ships with Interbase in PDF format.
The section called "Using a transaction component" in Chapter 10 "Building One- and
Two-Tiered Applications " should give you a better idea of how this component works.
If you are working with a remote database also read "Interbase Developers Guide"
Chapter 16, “Working with Cached Updates.” as this covers some of your queries regarding
network traffic.
Also
Interbase Operations Guide, Chapter 8 "Database and Server Statistics"
Section "Viewing lock statistics"
"All TIBCustomDataSet descendants and TIBSQL need to use a transaction along with a database component to gain access to data in a database."
While you are getting used to this component the ibTransaction.params property can be left blank,
the system will apply a set of default params which should be suitable for most applications.
To reduce the posibility of deadlocks you can use the following structure
ibTransaction1.StartTransa
ibQTable1.Insert;
ibQTable1.FieldByName('<Fi
ibQTable1.Post;
ibTransaction1.Commit; // end of transaction1
( or IBTransaction1.Rollback or IBTransaction1.RollbackRet
Have a look at "Interbase Developers Guide" which ships with Interbase in PDF format.
The section called "Using a transaction component" in Chapter 10 "Building One- and
Two-Tiered Applications " should give you a better idea of how this component works.
If you are working with a remote database also read "Interbase Developers Guide"
Chapter 16, “Working with Cached Updates.” as this covers some of your queries regarding
network traffic.
Also
Interbase Operations Guide, Chapter 8 "Database and Server Statistics"
Section "Viewing lock statistics"
ASKER
Thanx I have a look toady and let you know.
Enjoy your day
Enjoy your day
ASKER
using transaction with select statements, and which properties of the transaction compent is the most efficient way for select, updates and insert statements, to
minimize network traffic and to avoid dead locks.
Thank you
Henry