My application was coded under Delphi XE5 + Firebird-2.5.6, client / server. ZeosLib.
If I want to edit a record like this:
ZTable1.Edit;
ZTable1.FieldValues['champ1'] := Edit1.Text;
ZTable1.Post;
I wanted to know if this code on the local network, could it have worries or a conflict of editing and post please? That is, editing the table by multiple users will not even have an impact or an error message that pops up at those users. If yes, how to avoid this inconvenience please?
Thank you for your help.
It depends on the action with this record that will make the other user and how long your transaction will be active.
For read or after commit or rollback your transaction will be no conflict
Before a transaction end for editing or deleting the record of another user may lock a message or if a user transaction is started with no_wait flag, waiting edited transaction completion
P.S. Zeos for Firebird is a very straingth choice. Why you not uses standard IBX library?
Related
Using FireDAC in Delphi 10.2 to a Firebird 2.5 database, seeing a behavior I don't understand.
I open a TFDTable, Locate a desired record, call Edit and update some fields in that record and then call Post. If, after doing this and while the program is still running and the DB connection open, I open the DB in FlameRobin or other external data viewer and view the table, the changes I posted aren't visible in that external viewer and don't become visible until I close the DB connection as the program terminates. If I instead use a TFDQuery and normal transaction handling to UPDATE the same fields via SQL statement, the changes become visible in the external viewer immediately after the transaction is committed and I refresh the external view.
TFDTable.CachedUpdates and Exclusive are both False; Fetch, Field and Update options are at defaults; and UpdateObject and UpdateTransaction are unassigned.
What am I missing here? Thanks!
I developed an Client/Server application, using datasnap. I need to know how to refresh the data on the server whenever a client has updated a table. The reason being that when I run a query on the client, after I inserted records into a table, the new records do not reflect in the queries.
Im using a firebird db, with datasnap, developing in Delphi XE2
Put a TTimer control on the client form and specify refreshing time frequency, change interval value as your needs, for example:
procedure TForm1.Timer1Timer(Sender: TObject);
begin
table1.refresh;
end;
I would say, it also depends on tools you are using to write to DB.But, generally, with Firebird, you would Activate a Transaction and once update is done you would then Commit your changes. Prior to committing, no other client can see the new Changes no matter how many times they refresh. Once committed, my understanding would be to say, you would then Refresh you data by merely calling a SELECT command, as per your criteria.
How can I copy the information of a record from a master/detail clientdataset to a new record or to an existing one.
For example I want to copy te data of invoice No. 100 to Invoice No. 150 or the information of invoice No. 100 to a new Invoice
With IBX I did that with storedprocedures but I am running into trouble with clientdataset with 'lock conflict on no wait transaction' when I apply the updates, i think its becasue the information is already on the server side.
Thanks in advance
'Lock conflic on no wait transaction'?
AFAIR, it's an Interbase/Firebird error. It could mean that other connection modified the record and still doesn't committed yet....
UPDATE:
Other things that came to mind:
Have you revised your DBX connection configuration? If you don't know/ignore what CommitRetaining is/do, make sure it's configured to FALSE. Otherwise, other problems will arise...
On Firebird/Interbase, you can only commit/rollback from Client application. SPs have no business with transaction control.
at the moment i have a column "user_id" in the "threads" table cause one thread belongs to an user.
i want to make it like Stackoverflow that one thread can be editable by many users and you can see when they edited, what they edited, roll back changes and so on.
im using symfony, is there a plugin for this?
if no, are there any 3rd part libraries/plugins to download for this to integrate to existing database?
cause i have no idea how to implement this. it sounds like mediawiki, something that already exists?
thanks
Using User id as a way of remembering the original creator of the thread. Then just let any user edit a thread, don't limit to only the creator.
To do rollbacks you will need to store versions of your thread. One way would be to have a thread table and a version table.
The thread table would point to the current version, but if you need to rollback you can simply retrieve it from the versions table which should hold the history of all previous versions.
How do I track or get notified whenever a record is inserted or updated in a DB? I would like to notify an external application of the changes in near real time whenever such changes in DB occur. Are there DBMS independent and application programming language independent ways of doing this? If not, then is it possible with MS Access and MS SQL Server in particular? I'm looking to avoid continuous polling of DB of course.
With SQL Server it is possible to load a DLL within SQL Server itself and call methods from this with extended stored procedures. The DLL could then notify other applications - usually via a TCP socket.
I think the latest version of Microsoft SQL Server allows you to raise events in your .NET code based on server conditions and events. I haven't tried it, and I haven't heard of any 'DBMS independent' way of doing this (without polling DB every X milliseconds).
With MS-Access, I keep track of record changes or record additions with fields in the main table that store the user name and date when the record is created or updated.
You need to use a windows API to record the user name, usually run when switchboard form is opened.
I am digging to find a away to track specific changes. My data base is used for project management. I would like to keep track of what specifically was changed, not just who and when that I have now.
I think this meets the requirements of the original question. I can later add the windows API that reads the name of the user.
Private Sub Form_BeforeInsert(Cancel As Integer)
Me!UserCreated = UCase(CurrentUser())
Me!DateCreated = Now()
End Sub
Private Sub Form_BeforeUpdate(Cancel As Integer)
Me!DateModified = Now()
Me!UserModified = UCase(CurrentUser())
End Sub
-- Mike
To do this with SQL Server, you use the Notification Service - write a dll that subscribes to notifications from the DB for data updates which you can process in some way.
However, MS has said that they are removing this from SQL Server 2008.
Oracle has something similar (though they tend to leave their technology in place), but I've not seen anything that is database-neutral.