[interchange-cvs] interchange - jon modified 2 files
interchange-cvs at icdevgroup.org
interchange-cvs at icdevgroup.org
Tue May 13 22:33:15 UTC 2008
User: jon
Date: 2008-05-13 22:33:15 GMT
Modified: . WHATSNEW-5.5
Modified: lib/Vend Interpolate.pm
Log:
Change syntax for option to use custom SQL as a counter.
Resolves syntax conflict with MySQL pseudo-counters:
db_name:table_name(column_name)
Syntax is now:
dbname:SELECT function_name(args)
Revision Changes Path
1.117 interchange/WHATSNEW-5.5
rev 1.117, prev_rev 1.116
Index: WHATSNEW-5.5
===================================================================
RCS file: /var/cvs/interchange/WHATSNEW-5.5,v
retrieving revision 1.116
retrieving revision 1.117
diff -u -u -r1.116 -r1.117
--- WHATSNEW-5.5 7 May 2008 05:12:04 -0000 1.116
+++ WHATSNEW-5.5 13 May 2008 22:33:15 -0000 1.117
@@ -10,6 +10,24 @@
Interchange 5.5.3 not yet released.
+Core
+----
+
+* Change syntax for option to use custom SQL as a counter.
+
+ This allows something other than a plain database sequence to be used to
+ replace counter files, for example to allow character prefixes or suffixes
+ with sequences, or to avoid writing files locally when in a cluster
+ environment.
+
+ For example, if you create a function called "custom_counter" in PostgreSQL,
+ you could set up catalog.cfg like this:
+
+ UserDB default sql_counter "userdb:SELECT custom_counter('users')"
+ Route default sql_counter "transactions:SELECT custom_counter('orders')"
+
+ And whatever the custom_counter function returns will be used by Interchange.
+
Packaging
---------
@@ -135,14 +153,6 @@
with sequences, or to avoid writing files locally when in a cluster
environment.
- For example, if you create a function called "custom_counter" in PostgreSQL,
- you would set up catalog.cfg like this:
-
- UserDB default sql_counter "userdb:custom_counter('userdb_username_seq')"
- Route default sql_counter "transactions:custom_counter('order_number_seq')"
-
- And whatever the custom_counter function returns will be used by Interchange.
-
* Allow [if var ...] as shorthand for [if variable ...].
* Quell threaded perl warning for 5.8.8 and above.
2.303 interchange/lib/Vend/Interpolate.pm
rev 2.303, prev_rev 2.302
Index: Interpolate.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Interpolate.pm,v
retrieving revision 2.302
retrieving revision 2.303
diff -u -u -r2.302 -r2.303
--- Interpolate.pm 13 May 2008 02:53:13 -0000 2.302
+++ Interpolate.pm 13 May 2008 22:33:15 -0000 2.303
@@ -1,6 +1,6 @@
# Vend::Interpolate - Interpret Interchange tags
#
-# $Id: Interpolate.pm,v 2.302 2008-05-13 02:53:13 jon Exp $
+# $Id: Interpolate.pm,v 2.303 2008-05-13 22:33:15 jon Exp $
#
# Copyright (C) 2002-2008 Interchange Development Group
# Copyright (C) 1996-2002 Red Hat, Inc.
@@ -28,7 +28,7 @@
require Exporter;
@ISA = qw(Exporter);
-$VERSION = substr(q$Revision: 2.302 $, 10);
+$VERSION = substr(q$Revision: 2.303 $, 10);
@EXPORT = qw (
@@ -2170,10 +2170,9 @@
$opt->{sql},
);
}
- elsif($seq =~ /\(/) {
-#::logDebug("found custom SQL function for sequence: $seq");
- my $sql = "SELECT $seq";
- my $sth = $dbh->prepare($sql) or die $diemsg;
+ elsif($seq =~ /^\s*SELECT\W/i) {
+#::logDebug("found custom SQL SELECT for sequence: $seq");
+ my $sth = $dbh->prepare($seq) or die $diemsg;
$sth->execute or die $diemsg;
($val) = $sth->fetchrow_array;
}
More information about the interchange-cvs
mailing list