[jifty-devel] manual sql
Matt Zagrabelny
mzagrabe at d.umn.edu
Wed Dec 8 17:56:38 EST 2010
Greetings Jifty-ers,
I've got a question and possible feature request.
I've grepped the archives and did not find how to issue direct SQL. Is
it easy/doable?
The reason why I ask is this:
I would like to use the following transaction to act as a mutex for a
program I am writing that uses the Jifty DB as a datastore:
BEGIN;
LOCK TABLE mutexes NOWAIT;
-- perl code to insert data
if (successful lock) {
#code gets executed here
} else {
# report that another program is currently running
}
-- end of perl
ROLLBACK; -- allow other instances of this program to now run.
I've noticed that Jifty::DBI::Handle has the usual suspects of begin,
rollback, etc. Would it be possible to add something like:
$dbh->lock( table => 'mutexes', nowait => 1);
?
Thanks for the hints/help.
-matt
More information about the jifty-devel
mailing list