adding the start of base sql and marc functions for koha to mig-init
authorRogan Hamby <rhamby@equinoxinitiative.org>
Tue, 2 Jun 2020 13:49:08 +0000 (09:49 -0400)
committerRogan Hamby <rhamby@equinoxinitiative.org>
Tue, 2 Jun 2020 13:49:08 +0000 (09:49 -0400)
sql/koha/general_functions.sql [deleted file]
sql/koha/marc_functions.sql [deleted file]

diff --git a/sql/koha/general_functions.sql b/sql/koha/general_functions.sql
deleted file mode 100644 (file)
index 8dd0817..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-DROP FUNCTION IF EXISTS m_split_string;
-DELIMITER $
-CREATE FUNCTION 
-   m_split_string (s TEXT, del VARCHAR(10), i INT)
-   RETURNS TEXT
-   DETERMINISTIC
-    BEGIN
-        DECLARE n INT ;
-        SET n = LENGTH(s) - LENGTH(REPLACE(s, del, '')) + 1;
-        IF i > n THEN
-            RETURN NULL ;
-        ELSE
-            RETURN SUBSTRING_INDEX(SUBSTRING_INDEX(s, del, i) , del , -1 ) ;        
-        END IF;
-    END
-$
-DELIMITER ;
-
-DROP FUNCTION IF EXISTS m_string_segment_count;
-DELIMITER $
-CREATE FUNCTION 
-   m_string_segment_count(s TEXT, del VARCHAR(10))
-   RETURNS TEXT
-   DETERMINISTIC
-    BEGIN
-        DECLARE n INT ;
-        SET n = LENGTH(s) - LENGTH(REPLACE(s, del, '')) + 1;
-        RETURN n;
-    END
-$
-DELIMITER ;
-
-DROP FUNCTION IF EXISTS m_remove_bracketed_text;
-DELIMITER $
-CREATE FUNCTION 
-   m_remove_bracketed_text(str TEXT)
-   RETURNS TEXT
-   DETERMINISTIC
-    BEGIN
-    RETURN REPLACE(str, SUBSTRING(str, LOCATE('(', str), LENGTH(str) - LOCATE(')', REVERSE(str)) - LOCATE('(', str) + 2), '');
-    END
-$
-DELIMITER ;
-
-
diff --git a/sql/koha/marc_functions.sql b/sql/koha/marc_functions.sql
deleted file mode 100644 (file)
index 08d5e8e..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-
--- pass it the biblionumber, the position of the character to start in the leader starting at 0 
--- and the text to replace, single characer or multiple 
-DROP FUNCTION IF EXISTS m_update_leader;
-DELIMITER $
-CREATE FUNCTION
-   m_update_leader(bnumber INTEGER, ldr_position SMALLINT, new_value TEXT)
-   RETURNS BOOLEAN
-   DETERMINISTIC
-    BEGIN
-        DECLARE ldr TEXT COLLATE utf8mb4_unicode_ci DEFAULT NULL;
-        DECLARE new_value_length SMALLINT DEFAULT 1;
-        SET ldr_position = ldr_position + 1;
-        SET new_value_length = LENGTH(new_value);
-        
-        SELECT ExtractValue(metadata, '//leader') INTO ldr FROM biblio_metadata WHERE biblionumber = bnumber;
-        SET ldr = INSERT(ldr,ldr_position,new_value_length,new_value);
-        SET ldr = CONCAT('<leader>',ldr,'</leader>');
-
-        UPDATE biblio_metadata SET metadata = UpdateXML(metadata, '//leader', ldr) where biblionumber = bnumber;
-        RETURN TRUE;
-        
-    END
-$
-DELIMITER ;
-
-