projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
47d1873
)
acquire a database lock to prevent race conditions in duplicate checking
author
ivan
<ivan>
Sun, 5 Sep 2004 09:41:33 +0000
(09:41 +0000)
committer
ivan
<ivan>
Sun, 5 Sep 2004 09:41:33 +0000
(09:41 +0000)
FS/FS/svc_acct.pm
patch
|
blob
|
history
diff --git
a/FS/FS/svc_acct.pm
b/FS/FS/svc_acct.pm
index
f935df5
..
ded796f
100644
(file)
--- a/
FS/FS/svc_acct.pm
+++ b/
FS/FS/svc_acct.pm
@@
-247,6
+247,13
@@
sub insert {
#new duplicate username/username@domain/uid checking
#new duplicate username/username@domain/uid checking
+ #this is Pg-specific. what to do for mysql etc?
+ # ( mysql LOCK TABLES certainly isn't equivalent or useful here :/ )
+ warn "$me locking svc_acct table for duplicate search" if $DEBUG;
+ dbh->do("LOCK TABLE svc_acct IN SHARE ROW EXCLUSIVE MODE")
+ or die dbh->errstr;
+ warn "$me acquired svc_acct table lock for duplicate search" if $DEBUG;
+
my $part_svc = qsearchs('part_svc', { 'svcpart' => $self->svcpart } );
unless ( $part_svc ) {
$dbh->rollback if $oldAutoCommit;
my $part_svc = qsearchs('part_svc', { 'svcpart' => $self->svcpart } );
unless ( $part_svc ) {
$dbh->rollback if $oldAutoCommit;