From 2e455b086139fa6fd9b33680584e4e28544bb089 Mon Sep 17 00:00:00 2001 From: Kenichi Ishigaki Date: Sat, 18 Jan 2020 10:01:07 +0900 Subject: [PATCH] Add a note on the return value of a function for create_function --- lib/DBD/SQLite.pm | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/DBD/SQLite.pm b/lib/DBD/SQLite.pm index c51c1f2..47004e3 100644 --- a/lib/DBD/SQLite.pm +++ b/lib/DBD/SQLite.pm @@ -1927,6 +1927,13 @@ After this, it could be used from SQL as: INSERT INTO mytable ( now() ); +The function should return a scalar value, and the value is treated as a text +(or a number if appropriate) by default. If you do need to specify a type +of the return value (like BLOB), you can return a reference to an array that +contains the value and the type, as of 1.65_01. + + $dbh->sqlite_create_function( 'md5', 1, sub { return [md5($_[0]), SQL_BLOB] } ); + =head3 REGEXP function SQLite includes syntactic support for an infix operator 'REGEXP', but