Skip to content

shigenobu/mysql_ws_substring

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ws_substring - MySQL UDF for substring.

about

This is MySQL User Defined Function written by cgo.
Substring function.

arg explain
arg1 input input string
arg2 start start position (0 is first)
arg3 length substring length

why substring?

MySQL has already substring function.
But, when I tried to substring a huge text via JDBC or ADO.NET,
Incorrect string value: error was happened.
I don't understarnd why this error is happened, so I try to create this udf.

how to install

$ ./build.sh

(notice)

  • require root privilege

example

(simple1)

MariaDB [(none)]> select ws_substring('aaabbbccc', 3, 3);
+---------------------------------+
| ws_substring('aaabbbccc', 3, 3) |
+---------------------------------+
| bbb                             |
+---------------------------------+

(simple2)

MariaDB [(none)]> select ws_substring('𠮷野家で𠮷野がご飯をたべる', 3, 3);
+-----------------------------------------------------------+
| ws_substring('?野家で?野がご飯をたべる', 3, 3)            |
+-----------------------------------------------------------+
| で𠮷野                                                    |
+-----------------------------------------------------------+

About

MySQL UDF for substring.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published