From 984f27efc9ea5e579d1394292d8d2bb2f9123055 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Mon, 1 Jun 2009 11:23:27 +0000 Subject: - Patch #106559 by kbahey, catch, DamZ, chx et al: more drupal_lookup_path() optimizations. --- modules/system/system.install | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'modules/system/system.install') 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. @@ -3495,6 +3500,25 @@ function system_update_7023() { return $ret; } +/** + * 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. -- cgit v1.2.3