Transaction Processing
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Transaction Processing
I have been unable to find code to do Transaction Processing with a database.
Could someone forward the code and testing for proper implementation of a multi user database.
Thank you in advance for your help.
David J. Lamp
			
			
									
									
						Could someone forward the code and testing for proper implementation of a multi user database.
Thank you in advance for your help.
David J. Lamp
Re: Transaction Processing
Generally speaking, transactions are managed by Database self (there are specific SQL commands to do that).
I think you need to check SQL commands and documentation about you DB.
Which database are you using?
			
			
									
									I think you need to check SQL commands and documentation about you DB.
Which database are you using?
Runtime Revolution Widgets, tutorials, tips & tricks and more!
http://runrevwidgets.com/wiki
						http://runrevwidgets.com/wiki
Re: Transaction Processing
the transaction will be processed through runrev scripting.
I believe runrev will use the same format of scripting for sqlite, mysql or odbc calls.
The reason for transaction processing is to be able to effect a muti step write to one or more tables in a database. It is important that the state of the database cannot be changed outside of the completion of the muti step process before a commit or rollback which will unlock the database.
I can not find any documentation that establishes the "Begin" to lock the database and prevent potential updating by two processes out of order.
I was hoping to find a sample with the "Begin" and "Commit or Rollback" rev script.
I would think many people have the need for this requirement.
Best Regards,
David J. Lamp
			
			
									
									
						I believe runrev will use the same format of scripting for sqlite, mysql or odbc calls.
The reason for transaction processing is to be able to effect a muti step write to one or more tables in a database. It is important that the state of the database cannot be changed outside of the completion of the muti step process before a commit or rollback which will unlock the database.
I can not find any documentation that establishes the "Begin" to lock the database and prevent potential updating by two processes out of order.
I was hoping to find a sample with the "Begin" and "Commit or Rollback" rev script.
I would think many people have the need for this requirement.
Best Regards,
David J. Lamp
Re: Transaction Processing
Look at this thread, theres an example there that might get you started. http://forums.runrev.com/phpBB2/viewtop ... =12&t=2892
			
			
									
									
						Re: Transaction Processing
Hello,
I didn'0t work with DB using RunREv, but if you can send SQL commands, you could start / end transaction using SQL server DB commands.
Cheers!
			
			
									
									I didn'0t work with DB using RunREv, but if you can send SQL commands, you could start / end transaction using SQL server DB commands.
Cheers!
Runtime Revolution Widgets, tutorials, tips & tricks and more!
http://runrevwidgets.com/wiki
						http://runrevwidgets.com/wiki
Re: Transaction Processing
I don't really understand the issue.nikjerry wrote:I have read this all of the stuff and I just would like to say that I also have the same problem with me as well as I also using the SQL as a DB, but up till I didn't get any of the solution regarding to it.
we have one command that executes a SQL query :
revExecuteSQL dbID, dbSQL
So why don't you create the query like :
BEGIN;
INSERT INTO MYTABLE (MYCOLUMN) VALUES('1'),('2'),('3'),('4');
END;
or
BEGIN;
UPDATE MYTABLE SET MYCOLUMN=1 WHERE BLABLA=2
END;
If I remember correctly, It was working fine with SQLlite.
Re: Transaction Processing
Bangkok,
You were deceived. The previous message is spam.
Best,
Mark
			
			
									
									You were deceived. The previous message is spam.
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
						The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: Transaction Processing
Sorry Mark, could you elaborate ????Mark wrote: You were deceived. The previous message is spam.
 
 What do you mean ?
Re: Transaction Processing
Bangkok,
First of all, it is really unwise to reply to spam. By replying, you drag the attention of other forum members to the spam message and there's a chance they make the spam attack successful by clicking on the link in the signature. This could even be extremely dangerous, because such a link can lead to a fishing site, which steals your credit card data, twitter password, facebook password, login data for your bank account, and even the login name and password of your computer. Replying to spam is a mistake.
You can recognise spam when you are thinking "I really don't understand the issue" and see a link in the message or the signature. In 99.999% of cases, this indicates spam.
Best,
Mark
			
			
									
									First of all, it is really unwise to reply to spam. By replying, you drag the attention of other forum members to the spam message and there's a chance they make the spam attack successful by clicking on the link in the signature. This could even be extremely dangerous, because such a link can lead to a fishing site, which steals your credit card data, twitter password, facebook password, login data for your bank account, and even the login name and password of your computer. Replying to spam is a mistake.
You can recognise spam when you are thinking "I really don't understand the issue" and see a link in the message or the signature. In 99.999% of cases, this indicates spam.
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
						The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: Transaction Processing
Here is a real example I use in an import. 
			
			
									
									Code: Select all
revExecuteSQL gConID, "begin;"
   repeat for each line aLine in tAllRtnums
      put aline into tdata
      put char 1 to 9 of tdata into trtnum
      put char 10 of tdata into toffcd
     
       -- Insert the data into the table
       revExecuteSQL gConID, tSQL, "trtnum", "toffcd"
       end repeat
revexecuteSQL gConID, "commit;"
Developing with Windows XP & Revolution 4.5
						- 
				Janschenkel
- VIP Livecode Opensource Backer 
- Posts: 977
- Joined: Sat Apr 08, 2006 7:47 am
- Contact:
Re: Transaction Processing
You can also use the revCommitDatabase command at an appropriate spot, to commit all the INSERT, UPDATE and DELETE commands since the last commit.
Similarly, you can use this strategy to rollback if there is an error in the middle of the transaction, using the revRollbackDatabase command.
The revCommitDatabase and revRollbackDatabase commands will simply be ignored on databases that do not support transactions (yes, there are still some DBMS engines that are not ACID compliant) so if you ever switch the DBMS, the commands will still work; whereas running your own  and  pairs may cause an error.
HTH,
Jan Schenkel.
			
			
													Code: Select all
   repeat for each line aLine in tAllRtnums
      put aline into tdata
      put char 1 to 9 of tdata into trtnum
      put char 10 of tdata into toffcd
     
       -- Insert the data into the table
       revExecuteSQL gConID, tSQL, "trtnum", "toffcd"
   end repeat
   revCommitDatabase gConIDCode: Select all
   local tError, tLineNumber
   repeat for each line aLine in tAllRtnums
      add 1 to tLineNumber
      put aline into tdata
      put char 1 to 9 of tdata into trtnum
      put char 10 of tdata into toffcd
      -- let's assume there is a business rule here concerning toffcd
      if toffcd is not among the items of "a,b,c,d,e,f" then
         put "Invalid toffcd:" && toffcd && "on line:" && tLineNumber into tError
         exit repeat
      end if
      -- Insert the data into the table
      revExecuteSQL gConID, tSQL, "trtnum", "toffcd"
   end repeat
   if tError is empty then
      revCommitDatabase gConID
   else
      revRollbackDatabase gConID
      answer error tError
   end ifCode: Select all
revExecuteSql gConID, "begin;"Code: Select all
revExecuteSql gConID, "commit;"HTH,
Jan Schenkel.
					Last edited by Janschenkel on Sun Oct 03, 2010 7:32 pm, edited 1 time in total.
									
			
									Quartam Reports & PDF Library for LiveCode
www.quartam.com
						www.quartam.com
Re: Transaction Processing
Jan:
That is a very good point. I just learned something new again.
Thanks again.
			
			
									
									That is a very good point. I just learned something new again.
Thanks again.
Developing with Windows XP & Revolution 4.5
						