revdb_execute vs revExecuteSQL

Creating desktop or client-server database solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Peter K
Posts: 63
Joined: Sat Apr 09, 2011 9:33 pm

revdb_execute vs revExecuteSQL

Post by Peter K » Thu Jun 02, 2011 3:29 am

Any preference on which to use? I know that revdb_execute was introduced in version 1.1 and revExecuteSQL was introduced in version 2.0. Is revExecuteSQL an update for redb_execute?

Thanks,

Peter

SparkOut
Posts: 2949
Joined: Sun Sep 23, 2007 4:58 pm

Re: revdb_execute vs revExecuteSQL

Post by SparkOut » Thu Jun 02, 2011 10:47 am

The Livecode dictionary under the entry for revdb_execute wrote:Comments:
Evaluating the revdb_execute function has the same effect as executing the revExecuteSQL command. The only difference is that one is a function call and the other is a command.
Specifically the return value from the revdb_execute function should contain the number of rows affected by the query which should be available in the "it" variable. revExecuteSQL will return a value in "the result" which indicates the number of rows affected, or any error message.

Peter K
Posts: 63
Joined: Sat Apr 09, 2011 9:33 pm

Re: revdb_execute vs revExecuteSQL

Post by Peter K » Thu Jun 02, 2011 3:39 pm

Are there situations in which you would want to use one over the other? Or is it personal perference?

Thanks,

Peter

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Contact:

Re: revdb_execute vs revExecuteSQL

Post by Janschenkel » Sun Jun 05, 2011 12:14 pm

Nope, the two are equivalent, so it is a matter of programming style. The revdb_execute function was there first, when the revDB external was introduced back in version 1.1.1 - and all of the commands and functions in that external library were prefixed with 'revdb_' to make it easier to know where they were coming from. Around version 2.0, synonyms were added that simply start with 'rev' but were less low-level technical sounding (revdb_connect <> revOpenDatabase). And for fans of the command-query separation principle, it makes more sense to have a command than a function if you're modifying data.

I don't think either form will go away - but I personally hope that at some point in the future, the database calls get nice syntax baked into the language :-)

Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

Post Reply