Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 10 of 11 total
Thread multiple issues with Database GetTransactions and LoadTransactions
Fri, Aug 12 2016 4:37 PMPermanent Link

Emin

At this point in my project I must use GetTransactions / LoadTransactions methods of TDatabase

procedure TDatabase.LoadTransactions(const Value: String);
has this code:
if (TempOperationType <= Integer(otInsert)) or (TempOperationType > Integer(otDelete)) then
which raises exception in case of insert.

There is also parsing exception during LoadTransactions.

Can anyone recommend a fix?

Thanks
Emin Borbor


procedure TForm1.Button1Click(Sender: TObject);
var
  Str: string;
begin
  Database.StartTransaction;
  DataSet1.Open;
  DataSet1.Insert;
  DataSet1.Save;
  Str := Database.GetTransactions;
  Database.LoadTransactions(Str); // GET THE EXCEPTION HERE
end;
Fri, Aug 12 2016 5:00 PMPermanent Link

Walter Matte

Tactical Business Corporation

Emin:

What are you trying to do - this does not make any sense?

  Database.StartTransaction;
  DataSet1.Open;
  DataSet1.Insert;
  DataSet1.Save;
  Str := Database.GetTransactions;
  Database.LoadTransactions(Str); // GET THE EXCEPTION HERE


Open - Insert - Save - means it is already in the database.  Why would you ask for the JSON (GetTransaction) and reload (LoadTransaction) it?

Walter
Fri, Aug 12 2016 7:03 PMPermanent Link

Richard Harding

Wise Nutrition Coaching

Emin

Have you looked at the sample projects Transactions and Databound?  They are installed in the directory c:\Users\<user>\Documents\Elevate Web Builder 2\Projects.  These projects show how to access databases.

The basic steps are:
* Database.LoadRows: Load rows of a dataset from server
* Database.StartTransaction: Starts the log of changes to the local database
* Perform edits, inserts, deletes
* Database.Commit: Sends local database changes to server

EWB transactions are not database transactions.  EWB transactions logs changes to the local database so the changes can be sent back to the database on the sever.

Database.GetTransactions retrieves the log of current database operations that are waiting to be sent to the server.

Version 2.05 has automatic transactions.  This avoids the need to explicitly Start and Commit transactions.

Richard
Sat, Aug 13 2016 3:48 AMPermanent Link

Emin

Walter,

>What are you trying to do - this does not make any sense?

I know it does not make sense and I am not calling these methods as in this form in my projects.

But what I am trying to show in the code snippet is the exception problem.
Sat, Aug 13 2016 4:00 AMPermanent Link

Emin

Richard,

Thank your reply.
I know the steps, how EWB works, multitier and 2.05 AutoTransactions feature.
My problem is to grab EWB transactions and save them in the client.
And at later point put EWB transactions state to previously saved state. There is not server involvement.

Do you have a working example for GetTransactions and LoadTransactions?

Thank you,  
Emin
Sat, Aug 13 2016 4:23 PMPermanent Link

Richard Harding

Wise Nutrition Coaching

<<Do you have a working example for GetTransactions and LoadTransactions?>>

The sample project databound shows how to load from and save to local storage.

Richard
Sat, Aug 13 2016 5:24 PMPermanent Link

Emin

Richard

> The sample project databound shows how to load from and save to local storage.

Yes. But no sample that demonstrates Database.LoadTransactions.

I think Database.LoadTransactions needs to be fixed.

Emin Borbor
Sun, Aug 14 2016 7:28 AMPermanent Link

Walter Matte

Tactical Business Corporation

GetTransactions is fine.  Create a dataset dsTest with 2 columns - Id integer, Desc string 20.

procedure TfrmTest.Button1Click(Sender: TObject);
begin
 dsTest.Open;
 Database.StartTransaction;
 dsTest.Insert(false);
 dsTest.Columns['Id'].AsInteger := 1;
 dsTest.Columns['Desc'].AsString := 'Test 1';
 dsTest.Save;
 edMemo.lines.Text := Database.GetTransactions;
 Database.Rollback;
end;

The LoadTransactions has Bug(s) - I found the first issue.  But correcting it leads to another....


Javascript generated in the webdata_tdatabase.$p.loadtransactions = function(value)

Problem <=  should be <

          if ((tempoperationtype <= webdata_otinsert) || (tempoperationtype > webdata_otdelete))
                 throw new Error(webcore_translate1("ERR_DATA_TRANSOPTYPE", [inttostr(tempoperationtype)]));

Should be:

          if ((tempoperationtype < webdata_otinsert) || (tempoperationtype > webdata_otdelete))
                 throw new Error(webcore_translate1("ERR_DATA_TRANSOPTYPE", [inttostr(tempoperationtype)]));

Walter
Sun, Aug 14 2016 11:47 AMPermanent Link

Walter Matte

Tactical Business Corporation


I have reported this as an Incident report and Tim has already fix for next release.

Walter
Sun, Aug 14 2016 1:45 PMPermanent Link

Emin

Walter;

> I have reported this as an Incident report and Tim has already fix for next release.

Thanks Walter.

Tim
Can you share the fixed source before the next release please?

Emin Borbor
Page 1 of 2Next Page »
Jump to Page:  1 2
Image