projects
/
migration-tools.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
(parent:
57538f9
)
counting segments of string by delimiter
author
Rogan Hamby
<rhamby@equinoxinitiative.org>
Fri, 7 Feb 2020 14:41:16 +0000 (09:41 -0500)
committer
Rogan Hamby
<rhamby@equinoxinitiative.org>
Fri, 7 Feb 2020 14:41:16 +0000 (09:41 -0500)
sql/koha/general_functions.sql
patch
|
blob
|
history
diff --git
a/sql/koha/general_functions.sql
b/sql/koha/general_functions.sql
index
83f2c4c
..
6998171
100644
(file)
--- a/
sql/koha/general_functions.sql
+++ b/
sql/koha/general_functions.sql
@@
-16,4
+16,16
@@
CREATE FUNCTION
$
DELIMITER ;
-
+DROP FUNCTION IF EXISTS string_segment_count;
+DELIMITER $
+CREATE FUNCTION
+ 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 ;