summaryrefslogtreecommitdiff
path: root/modules/system
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2009-06-01 11:23:27 +0000
committerDries Buytaert <dries@buytaert.net>2009-06-01 11:23:27 +0000
commit984f27efc9ea5e579d1394292d8d2bb2f9123055 (patch)
treee689a13295f076b0563b0943d6f9cd783e13cd9a /modules/system
parent706ce87579e8c29953583a5bfd417aa7e1fbe4b5 (diff)
downloadbrdo-984f27efc9ea5e579d1394292d8d2bb2f9123055.tar.gz
brdo-984f27efc9ea5e579d1394292d8d2bb2f9123055.tar.bz2
- Patch #106559 by kbahey, catch, DamZ, chx et al: more drupal_lookup_path() optimizations.
Diffstat (limited to 'modules/system')
-rw-r--r--modules/system/system.install24
1 files changed, 24 insertions, 0 deletions
diff --git a/modules/system/system.install b/modules/system/system.install
index 15db982ca..4f94fb27e 100644
--- a/modules/system/system.install
+++ b/modules/system/system.install
@@ -339,6 +339,11 @@ function system_install() {
\'SELECT CASE WHEN $1 THEN $2 ELSE $3 END;\'
LANGUAGE \'sql\''
);
+
+ db_query('CREATE OR REPLACE FUNCTION "substr_index"(text, text, integer) RETURNS text AS
+ \'SELECT array_to_string((string_to_array($1, $2)) [1:$3], $2);\'
+ LANGUAGE \'sql\''
+ );
}
// Create tables.
@@ -3496,6 +3501,25 @@ function system_update_7023() {
}
/**
+ * Add the substr_index() function to PostgreSQL.
+ *
+ * Note: this should go into the driver itself, but we have no support
+ * for driver-specific updates yet.
+ */
+function system_update_7024() {
+ $ret = array();
+
+ if (db_driver() == 'pgsql') {
+ $ret[] = update_sql('CREATE OR REPLACE FUNCTION "substr_index"(text, text, integer) RETURNS text AS
+ \'SELECT array_to_string((string_to_array($1, $2)) [1:$3], $2);\'
+ LANGUAGE \'sql\''
+ );
+ }
+
+ return $ret;
+}
+
+/**
* @} End of "defgroup updates-6.x-to-7.x"
* The next series of updates should start at 8000.
*/