Changeset:
90d3683f5eae
https://sourceforge.net/p/mrbs/hg-code/ci/90d3683f5eaea8bdc6326041a3ba6b3c5388c55c
Author:
Campbell Morrison <[email protected]>
Date:
Wed Feb 22 15:31:14 2017 +0000
Log message:
Added PostgreSQL support for last change, and also fixed bug in MySQL
implementation.
diffstat:
web/lib/MRBS/DB_mysql.php | 1 +
web/lib/MRBS/DB_pgsql.php | 23 +++++++++++++++++++++++
2 files changed, 24 insertions(+), 0 deletions(-)
diffs (42 lines):
diff -r 73d40778ac8c -r 90d3683f5eae web/lib/MRBS/DB_mysql.php
--- a/web/lib/MRBS/DB_mysql.php Wed Feb 22 15:21:35 2017 +0000
+++ b/web/lib/MRBS/DB_mysql.php Wed Feb 22 15:31:14 2017 +0000
@@ -299,6 +299,7 @@
break;
case 2:
$count = -1;
+ break;
default:
throw new Exception("Invalid value ($part) given for " . '$part.');
break;
diff -r 73d40778ac8c -r 90d3683f5eae web/lib/MRBS/DB_pgsql.php
--- a/web/lib/MRBS/DB_pgsql.php Wed Feb 22 15:21:35 2017 +0000
+++ b/web/lib/MRBS/DB_pgsql.php Wed Feb 22 15:31:14 2017 +0000
@@ -316,4 +316,27 @@
{
return "#";
}
+
+
+ // Returns the syntax for a simple split of a column's value into two
+ // parts, separated by a delimiter. $part can be 1 or 2.
+ // Also takes a required pass-by-reference parameter to modify the SQL
+ // parameters appropriately.
+ public function syntax_simple_split($fieldname, $delimiter, $part, &$params)
+ {
+ switch ($part)
+ {
+ case 1:
+ case 2:
+ $count = $part;
+ break;
+ default:
+ throw new Exception("Invalid value ($part) given for " . '$part.');
+ break;
+ }
+
+ $params[] = $delimiter;
+ return "SPLIT_PART($fieldname, ?, $count)";
+ }
+
}
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits