Changeset: c8224a25ee1f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c8224a25ee1f
Modified Files:
        buildtools/autogen/scripts/sql2c.py
        sql/backends/monet5/Makefile.ag
        sql/backends/monet5/sql_scenario.c
        sql/scripts/09_like.sql.c
        sql/scripts/09_like.sql.h
        sql/scripts/10_math.sql.c
        sql/scripts/10_math.sql.h
        sql/scripts/11_times.sql.c
        sql/scripts/11_times.sql.h
        sql/scripts/12_url.sql.c
        sql/scripts/12_url.sql.h
        sql/scripts/13_date.sql.c
        sql/scripts/13_date.sql.h
        sql/scripts/14_inet.sql.c
        sql/scripts/14_inet.sql.h
        sql/scripts/15_querylog.sql.c
        sql/scripts/15_querylog.sql.h
        sql/scripts/16_tracelog.sql.c
        sql/scripts/16_tracelog.sql.h
        sql/scripts/17_temporal.sql.c
        sql/scripts/17_temporal.sql.h
        sql/scripts/18_index.sql.c
        sql/scripts/18_index.sql.h
        sql/scripts/20_vacuum.sql.c
        sql/scripts/20_vacuum.sql.h
        sql/scripts/21_dependency_views.sql.c
        sql/scripts/21_dependency_views.sql.h
        sql/scripts/22_clients.sql.c
        sql/scripts/22_clients.sql.h
        sql/scripts/23_skyserver.sql.c
        sql/scripts/23_skyserver.sql.h
        sql/scripts/25_debug.sql.c
        sql/scripts/25_debug.sql.h
        sql/scripts/26_sysmon.sql.c
        sql/scripts/26_sysmon.sql.h
        sql/scripts/27_rejects.sql.c
        sql/scripts/27_rejects.sql.h
        sql/scripts/39_analytics.sql.c
        sql/scripts/39_analytics.sql.h
        sql/scripts/39_analytics_hge.sql.c
        sql/scripts/39_analytics_hge.sql.h
        sql/scripts/40_json.sql.c
        sql/scripts/40_json.sql.h
        sql/scripts/40_json_hge.sql.c
        sql/scripts/40_json_hge.sql.h
        sql/scripts/41_md5sum.sql.c
        sql/scripts/41_md5sum.sql.h
        sql/scripts/45_uuid.sql.c
        sql/scripts/45_uuid.sql.h
        sql/scripts/46_profiler.sql.c
        sql/scripts/46_profiler.sql.h
        sql/scripts/51_sys_schema_extension.sql.c
        sql/scripts/51_sys_schema_extension.sql.h
        sql/scripts/60_wlcr.sql.c
        sql/scripts/60_wlcr.sql.h
        sql/scripts/75_storagemodel.sql.c
        sql/scripts/75_storagemodel.sql.h
        sql/scripts/80_statistics.sql.c
        sql/scripts/80_statistics.sql.h
        sql/scripts/99_system.sql
        sql/scripts/99_system.sql.c
        sql/scripts/99_system.sql.h
        sql/scripts/Makefile.ag
        sql/scripts/sql_scripts.c
        sql/scripts/sql_scripts.h
        sql/scripts/sql_scripts_hge.c
        sql/scripts/sql_scripts_hge.h
Branch: translate-scripts
Log Message:

Allocate sql scripts buffer only once.


diffs (truncated from 1317 to 300 lines):

diff --git a/buildtools/autogen/scripts/sql2c.py 
b/buildtools/autogen/scripts/sql2c.py
--- a/buildtools/autogen/scripts/sql2c.py
+++ b/buildtools/autogen/scripts/sql2c.py
@@ -49,14 +49,11 @@ insert1 = (
     'extern str SQLstatementIntern(Client c, str *expr, str nme, bit execute, 
bit output, res_table **result);\n'
     '\n'
     'str\n'
-    'sql_install_{0}(Client c)\n'
+    'sql_install_{0}(Client c, char *buf, size_t bufsize)\n'
     '{{\n'
-    '\tsize_t bufsize = 16384, pos = 0;\n'
-    '\tchar *buf = GDKmalloc(bufsize), *err = NULL;\n'
+    '\tsize_t pos = 0;\n'
     '\n'
-    '\tif (buf == NULL)\n'
-    '\t\tthrow(SQL, "sql.install_{1}", SQLSTATE(HY001) MAL_MALLOC_FAIL);\n'
-    '\tpos += snprintf(buf + pos, bufsize - pos, "').format(filebasename, 
filebasename)
+    '\tpos += snprintf(buf, bufsize, "').format(filebasename, filebasename)
 
 sql_c_output_file.write(insert1)
 
@@ -180,9 +177,7 @@ insert2 = (
 '\n'
 '\tassert(pos < bufsize);\n'
 '\tprintf("#Loading: {0}{1}\\n");\n'
-'\terr = SQLstatementIntern(c, &buf, "install", 1, 0, NULL);\n'
-'\tGDKfree(buf);\n'
-'\treturn err;\n'
+'\treturn SQLstatementIntern(c, &buf, "install", 1, 0, NULL);\n'
 '}}\n').format(filebasename, split[1])
 
 sql_c_output_file.write(insert2)
@@ -208,7 +203,7 @@ insert3 = (
     '#include "gdk.h"\n'
     '#include "mal_client.h"\n'
     '\n'
-    'extern str sql_install_{1}(Client c);\n'
+    'extern str sql_install_{1}(Client c, char *buf, size_t bufsize);\n'
     '\n'
     '#endif //SQL_{0}_H\n').format(filebasename.upper(), filebasename)
 
diff --git a/sql/backends/monet5/Makefile.ag b/sql/backends/monet5/Makefile.ag
--- a/sql/backends/monet5/Makefile.ag
+++ b/sql/backends/monet5/Makefile.ag
@@ -49,6 +49,7 @@ lib__sql = {
                sql_rank.c sql_rank.h
        # libmapi on Windows for mcrypt_*
        LIBS = ../../server/libsqlserver \
+               ../../scripts/libsqlscripts \
                ../../storage/libstore \
                ../../storage/bat/libbatstore \
                ../../common/libsqlcommon \
@@ -56,7 +57,8 @@ lib__sql = {
                WIN32?../../../monetdb5/tools/libmonetdb5 \
                WIN32?../../../gdk/libbat \
                WIN32?../../../common/stream/libstream \
-               WIN32?$(openssl_LIBS)
+               WIN32?$(openssl_LIBS) \
+               HAVE_HGE?../../scripts/libsqlscriptshge
 }
 
 headers_mal = {
diff --git a/sql/backends/monet5/sql_scenario.c 
b/sql/backends/monet5/sql_scenario.c
--- a/sql/backends/monet5/sql_scenario.c
+++ b/sql/backends/monet5/sql_scenario.c
@@ -470,16 +470,29 @@ SQLinit(Client c)
                        SQLnewcatalog = 1;
        }
        if (SQLnewcatalog > 0) {
+               size_t bufsize = 16384;
+               char *buf = GDKmalloc(bufsize);
+
                SQLnewcatalog = 0;
                maybeupgrade = 0;
 
-               if ((msg = install_sql_scripts(c)) != MAL_SUCCEED)
+               if (buf == NULL)
+                       throw(SQL, "createdb", SQLSTATE(HY001) MAL_MALLOC_FAIL);
+
+               if ((msg = install_sql_scripts(c, buf, bufsize)) != 
MAL_SUCCEED) {
+                       MT_lock_unset(&sql_contextLock);
+                       GDKfree(buf);
                        return msg;
+               }
 #ifdef HAVE_HGE
-               if ((msg = install_sql_scripts_hge(c)) != MAL_SUCCEED)
+               if ((msg = install_sql_scripts_hge(c, buf, bufsize)) != 
MAL_SUCCEED) {
+                       MT_lock_unset(&sql_contextLock);
+                       GDKfree(buf);
                        return msg;
+               }
 #endif
 
+               GDKfree(buf);
                if (m->sa)
                        sa_destroy(m->sa);
                m->sa = NULL;
diff --git a/sql/scripts/09_like.sql.c b/sql/scripts/09_like.sql.c
--- a/sql/scripts/09_like.sql.c
+++ b/sql/scripts/09_like.sql.c
@@ -21,20 +21,15 @@
 extern str SQLstatementIntern(Client c, str *expr, str nme, bit execute, bit 
output, res_table **result);
 
 str
-sql_install_09_like(Client c)
+sql_install_09_like(Client c, char *buf, size_t bufsize)
 {
-       size_t bufsize = 16384, pos = 0;
-       char *buf = GDKmalloc(bufsize), *err = NULL;
+       size_t pos = 0;
 
-       if (buf == NULL)
-               throw(SQL, "sql.install_09_like", SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
-       pos += snprintf(buf + pos, bufsize - pos, " create filter function 
\"like\"(val string, pat string, esc string) external name algebra.\"like\"; 
create filter function \"ilike\"(val string, pat string, esc string) external 
name algebra.\"ilike\"; create filter function \"like\"(val string, pat string) 
external name algebra.\"like\"; create filter function \"ilike\"(val string, 
pat string) external name algebra.\"ilike\"; grant execute on filter function 
\"like\" (string, string, string) to public; grant execute on filter function 
\"ilike\" (string, string, string) to public; grant execute on filter function 
\"like\" (string, string) to public; grant execute on filter function \"ilike\" 
(string, string) to public;");
+       pos += snprintf(buf, bufsize, " create filter function \"like\"(val 
string, pat string, esc string) external name algebra.\"like\"; create filter 
function \"ilike\"(val string, pat string, esc string) external name 
algebra.\"ilike\"; create filter function \"like\"(val string, pat string) 
external name algebra.\"like\"; create filter function \"ilike\"(val string, 
pat string) external name algebra.\"ilike\"; grant execute on filter function 
\"like\" (string, string, string) to public; grant execute on filter function 
\"ilike\" (string, string, string) to public; grant execute on filter function 
\"like\" (string, string) to public; grant execute on filter function \"ilike\" 
(string, string) to public;");
 
        pos += snprintf(buf + pos, bufsize - pos, "commit;\n");
 
        assert(pos < bufsize);
        printf("#Loading: 09_like.sql\n");
-       err = SQLstatementIntern(c, &buf, "install", 1, 0, NULL);
-       GDKfree(buf);
-       return err;
+       return SQLstatementIntern(c, &buf, "install", 1, 0, NULL);
 }
diff --git a/sql/scripts/09_like.sql.h b/sql/scripts/09_like.sql.h
--- a/sql/scripts/09_like.sql.h
+++ b/sql/scripts/09_like.sql.h
@@ -17,6 +17,6 @@
 #include "gdk.h"
 #include "mal_client.h"
 
-extern str sql_install_09_like(Client c);
+extern str sql_install_09_like(Client c, char *buf, size_t bufsize);
 
 #endif //SQL_09_LIKE_H
diff --git a/sql/scripts/10_math.sql.c b/sql/scripts/10_math.sql.c
--- a/sql/scripts/10_math.sql.c
+++ b/sql/scripts/10_math.sql.c
@@ -21,20 +21,15 @@
 extern str SQLstatementIntern(Client c, str *expr, str nme, bit execute, bit 
output, res_table **result);
 
 str
-sql_install_10_math(Client c)
+sql_install_10_math(Client c, char *buf, size_t bufsize)
 {
-       size_t bufsize = 16384, pos = 0;
-       char *buf = GDKmalloc(bufsize), *err = NULL;
+       size_t pos = 0;
 
-       if (buf == NULL)
-               throw(SQL, "sql.install_10_math", SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
-       pos += snprintf(buf + pos, bufsize - pos, " CREATE FUNCTION degrees(r 
double) RETURNS double RETURN r*180/pi(); CREATE FUNCTION radians(d double) 
RETURNS double RETURN d*pi()/180; grant execute on function degrees to public; 
grant execute on function radians to public;");
+       pos += snprintf(buf, bufsize, " CREATE FUNCTION degrees(r double) 
RETURNS double RETURN r*180/pi(); CREATE FUNCTION radians(d double) RETURNS 
double RETURN d*pi()/180; grant execute on function degrees to public; grant 
execute on function radians to public;");
 
        pos += snprintf(buf + pos, bufsize - pos, "commit;\n");
 
        assert(pos < bufsize);
        printf("#Loading: 10_math.sql\n");
-       err = SQLstatementIntern(c, &buf, "install", 1, 0, NULL);
-       GDKfree(buf);
-       return err;
+       return SQLstatementIntern(c, &buf, "install", 1, 0, NULL);
 }
diff --git a/sql/scripts/10_math.sql.h b/sql/scripts/10_math.sql.h
--- a/sql/scripts/10_math.sql.h
+++ b/sql/scripts/10_math.sql.h
@@ -17,6 +17,6 @@
 #include "gdk.h"
 #include "mal_client.h"
 
-extern str sql_install_10_math(Client c);
+extern str sql_install_10_math(Client c, char *buf, size_t bufsize);
 
 #endif //SQL_10_MATH_H
diff --git a/sql/scripts/11_times.sql.c b/sql/scripts/11_times.sql.c
--- a/sql/scripts/11_times.sql.c
+++ b/sql/scripts/11_times.sql.c
@@ -21,20 +21,15 @@
 extern str SQLstatementIntern(Client c, str *expr, str nme, bit execute, bit 
output, res_table **result);
 
 str
-sql_install_11_times(Client c)
+sql_install_11_times(Client c, char *buf, size_t bufsize)
 {
-       size_t bufsize = 16384, pos = 0;
-       char *buf = GDKmalloc(bufsize), *err = NULL;
+       size_t pos = 0;
 
-       if (buf == NULL)
-               throw(SQL, "sql.install_11_times", SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
-       pos += snprintf(buf + pos, bufsize - pos, "  create procedure times() 
external name sql.times; grant execute on procedure times to public;");
+       pos += snprintf(buf, bufsize, "  create procedure times() external name 
sql.times; grant execute on procedure times to public;");
 
        pos += snprintf(buf + pos, bufsize - pos, "commit;\n");
 
        assert(pos < bufsize);
        printf("#Loading: 11_times.sql\n");
-       err = SQLstatementIntern(c, &buf, "install", 1, 0, NULL);
-       GDKfree(buf);
-       return err;
+       return SQLstatementIntern(c, &buf, "install", 1, 0, NULL);
 }
diff --git a/sql/scripts/11_times.sql.h b/sql/scripts/11_times.sql.h
--- a/sql/scripts/11_times.sql.h
+++ b/sql/scripts/11_times.sql.h
@@ -17,6 +17,6 @@
 #include "gdk.h"
 #include "mal_client.h"
 
-extern str sql_install_11_times(Client c);
+extern str sql_install_11_times(Client c, char *buf, size_t bufsize);
 
 #endif //SQL_11_TIMES_H
diff --git a/sql/scripts/12_url.sql.c b/sql/scripts/12_url.sql.c
--- a/sql/scripts/12_url.sql.c
+++ b/sql/scripts/12_url.sql.c
@@ -21,20 +21,15 @@
 extern str SQLstatementIntern(Client c, str *expr, str nme, bit execute, bit 
output, res_table **result);
 
 str
-sql_install_12_url(Client c)
+sql_install_12_url(Client c, char *buf, size_t bufsize)
 {
-       size_t bufsize = 16384, pos = 0;
-       char *buf = GDKmalloc(bufsize), *err = NULL;
+       size_t pos = 0;
 
-       if (buf == NULL)
-               throw(SQL, "sql.install_12_url", SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
-       pos += snprintf(buf + pos, bufsize - pos, " CREATE TYPE url EXTERNAL 
NAME url; CREATE function getAnchor( theUrl url ) RETURNS STRING EXTERNAL NAME 
url.\"getAnchor\"; GRANT EXECUTE ON FUNCTION getAnchor(url) TO PUBLIC; CREATE 
function getBasename(theUrl url) RETURNS STRING EXTERNAL NAME 
url.\"getBasename\"; GRANT EXECUTE ON FUNCTION getBasename(url) TO PUBLIC; 
CREATE function getContent(theUrl url) RETURNS STRING EXTERNAL NAME 
url.\"getContent\"; GRANT EXECUTE ON FUNCTION getContent(url) TO PUBLIC; CREATE 
function getContext(theUrl url) RETURNS STRING EXTERNAL NAME 
url.\"getContext\"; GRANT EXECUTE ON FUNCTION getContext(url) TO PUBLIC; CREATE 
function getDomain(theUrl url) RETURNS STRING EXTERNAL NAME url.\"getDomain\"; 
GRANT EXECUTE ON FUNCTION getDomain(url) TO PUBLIC; CREATE function 
getExtension(theUrl url) RETURNS STRING EXTERNAL NAME url.\"getExtension\"; 
GRANT EXECUTE ON FUNCTION getExtension(url) TO PUBLIC; CREATE function 
getFile(theUrl url) RETURNS STRING EXTERNAL NAME u
 rl.\"getFile\"; GRANT EXECUTE ON FUNCTION getFile(url) TO PUBLIC; CREATE 
function getHost(theUrl url) RETURNS STRING EXTERNAL NAME url.\"getHost\"; 
GRANT EXECUTE ON FUNCTION getHost(url) TO PUBLIC; CREATE function 
getPort(theUrl url) RETURNS STRING EXTERNAL NAME url.\"getPort\"; GRANT EXECUTE 
ON FUNCTION getPort(url) TO PUBLIC; CREATE function getProtocol(theUrl url) 
RETURNS STRING EXTERNAL NAME url.\"getProtocol\"; GRANT EXECUTE ON FUNCTION 
getProtocol(url) TO PUBLIC; CREATE function getQuery(theUrl url) RETURNS STRING 
EXTERNAL NAME url.\"getQuery\"; GRANT EXECUTE ON FUNCTION getQuery(url) TO 
PUBLIC; CREATE function getUser(theUrl url) RETURNS STRING EXTERNAL NAME 
url.\"getUser\"; GRANT EXECUTE ON FUNCTION getUser(url) TO PUBLIC; CREATE 
function getRobotURL(theUrl url) RETURNS STRING EXTERNAL NAME 
url.\"getRobotURL\"; GRANT EXECUTE ON FUNCTION getRobotURL(url) TO PUBLIC; 
CREATE function isaURL(theUrl url) RETURNS BOOL EXTERNAL NAME url.\"isaURL\"; 
GRANT EXECUTE ON FUNCTION isaURL(u
 rl) TO PUBLIC; CREATE function newurl(protocol STRING, hostname STRING, 
\"port\" INT, file STRING) RETURNS url EXTERNAL NAME url.\"new\"; GRANT EXECUTE 
ON FUNCTION newurl(STRING, STRING, INT, STRING) TO PUBLIC; CREATE function 
newurl(protocol STRING, hostname STRING, file STRING) RETURNS url EXTERNAL NAME 
url.\"new\"; GRANT EXECUTE ON FUNCTION newurl(STRING, STRING, STRING) TO 
PUBLIC;");
+       pos += snprintf(buf, bufsize, " CREATE TYPE url EXTERNAL NAME url; 
CREATE function getAnchor( theUrl url ) RETURNS STRING EXTERNAL NAME 
url.\"getAnchor\"; GRANT EXECUTE ON FUNCTION getAnchor(url) TO PUBLIC; CREATE 
function getBasename(theUrl url) RETURNS STRING EXTERNAL NAME 
url.\"getBasename\"; GRANT EXECUTE ON FUNCTION getBasename(url) TO PUBLIC; 
CREATE function getContent(theUrl url) RETURNS STRING EXTERNAL NAME 
url.\"getContent\"; GRANT EXECUTE ON FUNCTION getContent(url) TO PUBLIC; CREATE 
function getContext(theUrl url) RETURNS STRING EXTERNAL NAME 
url.\"getContext\"; GRANT EXECUTE ON FUNCTION getContext(url) TO PUBLIC; CREATE 
function getDomain(theUrl url) RETURNS STRING EXTERNAL NAME url.\"getDomain\"; 
GRANT EXECUTE ON FUNCTION getDomain(url) TO PUBLIC; CREATE function 
getExtension(theUrl url) RETURNS STRING EXTERNAL NAME url.\"getExtension\"; 
GRANT EXECUTE ON FUNCTION getExtension(url) TO PUBLIC; CREATE function 
getFile(theUrl url) RETURNS STRING EXTERNAL NAME url.\"getFile
 \"; GRANT EXECUTE ON FUNCTION getFile(url) TO PUBLIC; CREATE function 
getHost(theUrl url) RETURNS STRING EXTERNAL NAME url.\"getHost\"; GRANT EXECUTE 
ON FUNCTION getHost(url) TO PUBLIC; CREATE function getPort(theUrl url) RETURNS 
STRING EXTERNAL NAME url.\"getPort\"; GRANT EXECUTE ON FUNCTION getPort(url) TO 
PUBLIC; CREATE function getProtocol(theUrl url) RETURNS STRING EXTERNAL NAME 
url.\"getProtocol\"; GRANT EXECUTE ON FUNCTION getProtocol(url) TO PUBLIC; 
CREATE function getQuery(theUrl url) RETURNS STRING EXTERNAL NAME 
url.\"getQuery\"; GRANT EXECUTE ON FUNCTION getQuery(url) TO PUBLIC; CREATE 
function getUser(theUrl url) RETURNS STRING EXTERNAL NAME url.\"getUser\"; 
GRANT EXECUTE ON FUNCTION getUser(url) TO PUBLIC; CREATE function 
getRobotURL(theUrl url) RETURNS STRING EXTERNAL NAME url.\"getRobotURL\"; GRANT 
EXECUTE ON FUNCTION getRobotURL(url) TO PUBLIC; CREATE function isaURL(theUrl 
url) RETURNS BOOL EXTERNAL NAME url.\"isaURL\"; GRANT EXECUTE ON FUNCTION 
isaURL(url) TO PUBLI
 C; CREATE function newurl(protocol STRING, hostname STRING, \"port\" INT, file 
STRING) RETURNS url EXTERNAL NAME url.\"new\"; GRANT EXECUTE ON FUNCTION 
newurl(STRING, STRING, INT, STRING) TO PUBLIC; CREATE function newurl(protocol 
STRING, hostname STRING, file STRING) RETURNS url EXTERNAL NAME url.\"new\"; 
GRANT EXECUTE ON FUNCTION newurl(STRING, STRING, STRING) TO PUBLIC;");
 
        pos += snprintf(buf + pos, bufsize - pos, "commit;\n");
 
        assert(pos < bufsize);
        printf("#Loading: 12_url.sql\n");
-       err = SQLstatementIntern(c, &buf, "install", 1, 0, NULL);
-       GDKfree(buf);
-       return err;
+       return SQLstatementIntern(c, &buf, "install", 1, 0, NULL);
 }
diff --git a/sql/scripts/12_url.sql.h b/sql/scripts/12_url.sql.h
--- a/sql/scripts/12_url.sql.h
+++ b/sql/scripts/12_url.sql.h
@@ -17,6 +17,6 @@
 #include "gdk.h"
 #include "mal_client.h"
 
-extern str sql_install_12_url(Client c);
+extern str sql_install_12_url(Client c, char *buf, size_t bufsize);
 
 #endif //SQL_12_URL_H
diff --git a/sql/scripts/13_date.sql.c b/sql/scripts/13_date.sql.c
--- a/sql/scripts/13_date.sql.c
+++ b/sql/scripts/13_date.sql.c
@@ -21,20 +21,15 @@
 extern str SQLstatementIntern(Client c, str *expr, str nme, bit execute, bit 
output, res_table **result);
 
 str
-sql_install_13_date(Client c)
+sql_install_13_date(Client c, char *buf, size_t bufsize)
 {
-       size_t bufsize = 16384, pos = 0;
-       char *buf = GDKmalloc(bufsize), *err = NULL;
+       size_t pos = 0;
 
-       if (buf == NULL)
-               throw(SQL, "sql.install_13_date", SQLSTATE(HY001) 
MAL_MALLOC_FAIL);
-       pos += snprintf(buf + pos, bufsize - pos, " create function 
str_to_date(s string, format string) returns date external name 
mtime.\"str_to_date\"; create function date_to_str(d date, format string) 
returns string external name mtime.\"date_to_str\"; create function 
str_to_time(s string, format string) returns time external name 
mtime.\"str_to_time\"; create function time_to_str(d time, format string) 
returns string external name mtime.\"time_to_str\"; create function 
str_to_timestamp(s string, format string) returns timestamp external name 
mtime.\"str_to_timestamp\"; create function timestamp_to_str(d timestamp, 
format string) returns string external name mtime.\"timestamp_to_str\"; grant 
execute on function str_to_date to public; grant execute on function 
date_to_str to public; grant execute on function str_to_time to public; grant 
execute on function time_to_str to public; grant execute on function 
str_to_timestamp to public; grant execute on function timestamp_to_str to 
public;"
 );
+       pos += snprintf(buf, bufsize, " create function str_to_date(s string, 
format string) returns date external name mtime.\"str_to_date\"; create 
function date_to_str(d date, format string) returns string external name 
mtime.\"date_to_str\"; create function str_to_time(s string, format string) 
returns time external name mtime.\"str_to_time\"; create function time_to_str(d 
time, format string) returns string external name mtime.\"time_to_str\"; create 
function str_to_timestamp(s string, format string) returns timestamp external 
name mtime.\"str_to_timestamp\"; create function timestamp_to_str(d timestamp, 
format string) returns string external name mtime.\"timestamp_to_str\"; grant 
execute on function str_to_date to public; grant execute on function 
date_to_str to public; grant execute on function str_to_time to public; grant 
execute on function time_to_str to public; grant execute on function 
str_to_timestamp to public; grant execute on function timestamp_to_str to 
public;");
 
        pos += snprintf(buf + pos, bufsize - pos, "commit;\n");
 
        assert(pos < bufsize);
        printf("#Loading: 13_date.sql\n");
-       err = SQLstatementIntern(c, &buf, "install", 1, 0, NULL);
-       GDKfree(buf);
-       return err;
+       return SQLstatementIntern(c, &buf, "install", 1, 0, NULL);
 }
diff --git a/sql/scripts/13_date.sql.h b/sql/scripts/13_date.sql.h
--- a/sql/scripts/13_date.sql.h
+++ b/sql/scripts/13_date.sql.h
@@ -17,6 +17,6 @@
 #include "gdk.h"
 #include "mal_client.h"
 
-extern str sql_install_13_date(Client c);
+extern str sql_install_13_date(Client c, char *buf, size_t bufsize);
 
 #endif //SQL_13_DATE_H
diff --git a/sql/scripts/14_inet.sql.c b/sql/scripts/14_inet.sql.c
--- a/sql/scripts/14_inet.sql.c
+++ b/sql/scripts/14_inet.sql.c
@@ -21,20 +21,15 @@
 extern str SQLstatementIntern(Client c, str *expr, str nme, bit execute, bit 
output, res_table **result);
 
 str
-sql_install_14_inet(Client c)
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to