Changeset: f928f414e85d for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f928f414e85d Modified Files: buildtools/Mx/Code.c sql/src/backends/monet5/sql_scenario.mx sql/src/sql/Makefile.ag sql/src/sql/admin.sql sql/src/sql/bbp.sql sql/src/sql/cache.sql sql/src/sql/mtime.sql sql/src/sql/stats.sql sql/src/sql/times.sql sql/src/sql/url.sql sql/src/test/BugTracker/Tests/caching.SF-1651599.sql sql/src/test/Skyserver/Skyserver_dropCache.sql sql/src/test/Skyserver/run.all sql/src/test/Skyserver/runv6.all sql/src/test/leaks/Tests/bbp.sql.src Branch: Jun2010 Log Message:
Backport of commit 15fa5ace4eb3 with modifications. The sql.include function has been dropped due to deep conflicts. author [email protected] date Fri May 07 12:12:41 2010 +0200 (6 days ago) Collect all definitions into a createdb startup script. diffs (289 lines): diff -r e0f2dbc76212 -r f928f414e85d buildtools/Mx/Code.c --- a/buildtools/Mx/Code.c Thu May 13 16:57:58 2010 +0200 +++ b/buildtools/Mx/Code.c Thu May 13 19:03:24 2010 +0200 @@ -378,6 +378,7 @@ break; case Haskell: + case SQL: ofile_printf("\n-- %s:%d \n", mx_file, mx_line); break; diff -r e0f2dbc76212 -r f928f414e85d sql/src/backends/monet5/sql_scenario.mx --- a/sql/src/backends/monet5/sql_scenario.mx Thu May 13 16:57:58 2010 +0200 +++ b/sql/src/backends/monet5/sql_scenario.mx Thu May 13 19:03:24 2010 +0200 @@ -88,6 +88,7 @@ #include <unistd.h> static int SQLinitialized = 0; +static int SQLnewcatalog = 0; static int SQLdebug = 0; static char *sqlinit = NULL; MT_Lock sql_contextLock; @@ -158,6 +159,9 @@ if (!s) throw(MAL, "sql.start", "out of scenario slots"); sqlinit = GDKgetenv("sqlinit"); + if (sqlinit == NULL) { + /* gather the database initialization scripts*/ + } s->name = "S_Q_L"; s->language = "sql"; s->initSystem = NULL; @@ -266,11 +270,11 @@ if (readonly) SQLdebug |= 32; dbname = GDKgetenv("gdk_dbname"); - if (((SQLdebug&16)==16 && mvc_init(dbname, FALSE, store_bpm, 0) < 0) || - ((SQLdebug&96)==96 && mvc_init(dbname, FALSE, store_suro, 0) < 0) || - ((SQLdebug&96)==64 && mvc_init(dbname, FALSE, store_su, 0) < 0) || - ((SQLdebug&96)==32 && mvc_init(dbname, FALSE, store_ro, 0) < 0) || - ((SQLdebug&112)==0 && mvc_init(dbname, FALSE, store_bat, 0) < 0)) + if (((SQLdebug&16)==16 && (SQLnewcatalog = mvc_init(dbname, FALSE, store_bpm, 0)) < 0) || + ((SQLdebug&96)==96 && (SQLnewcatalog = mvc_init(dbname, FALSE, store_suro, 0)) < 0) || + ((SQLdebug&96)==64 && (SQLnewcatalog = mvc_init(dbname, FALSE, store_su, 0)) < 0) || + ((SQLdebug&96)==32 && (SQLnewcatalog = mvc_init(dbname, FALSE, store_ro, 0)) < 0) || + ((SQLdebug&112)==0 && (SQLnewcatalog = mvc_init(dbname, FALSE, store_bat, 0)) < 0)) throw(SQL, "SQLinit", "Catalogue initialization failed"); SQLinitialized = TRUE; mal_unset_lock(sql_contextLock,"SQL init"); @@ -409,7 +413,14 @@ #endif if (SQLinitialized == 0 ) SQLprelude(); - +...@- +Based on the initialization retun value we can prepare a SQLinit string with all information needed +to initialize the catalog based on the mandatory scripts to be executed. +...@c + if ( SQLnewcatalog > 0 && sqlinit == NULL){ + stream_printf(GDKout,"# SQL catalog created, load the sql scripts once\n"); + SQLnewcatalog = 0; + } if (sqlinit) { /* add sqlinit to the fdin stack */ buffer *b = (buffer*)GDKmalloc(sizeof(buffer)); size_t len = strlen(sqlinit); @@ -586,7 +597,7 @@ scanner_init( &m->scanner, bstream_create(buffer_rastream(b, "sqlstatement"), b->len), NULL); - m->scanner.mode = LINE_1; + m->scanner.mode = LINE_N; bstream_next(m->scanner.rs); m->params = NULL; diff -r e0f2dbc76212 -r f928f414e85d sql/src/sql/Makefile.ag --- a/sql/src/sql/Makefile.ag Thu May 13 16:57:58 2010 +0200 +++ b/sql/src/sql/Makefile.ag Thu May 13 19:03:24 2010 +0200 @@ -19,10 +19,10 @@ HEADERS = sql DIR = datadir/MonetDB/sql SOURCES = \ - admin.sql bbp.sql \ - cache.sql clients.sql cluster.sql \ + createdb.mx \ + clients.sql cluster.sql \ date.sql history.sql inet.sql \ math.sql mtime.sql \ - stats.sql times.sql url.sql \ + times.sql url.sql \ dependency_functions.sql skyserver.sql } diff -r e0f2dbc76212 -r f928f414e85d sql/src/sql/admin.sql --- a/sql/src/sql/admin.sql Thu May 13 16:57:58 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ --- The contents of this file are subject to the MonetDB Public License --- Version 1.1 (the "License"); you may not use this file except in --- compliance with the License. You may obtain a copy of the License at --- http://monetdb.cwi.nl/Legal/MonetDBLicense-1.1.html --- --- Software distributed under the License is distributed on an "AS IS" --- basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the --- License for the specific language governing rights and limitations --- under the License. --- --- The Original Code is the MonetDB Database System. --- --- The Initial Developer of the Original Code is CWI. --- Copyright August 2008-2010 MonetDB B.V. --- All Rights Reserved. - --- The MonetDB kernel environment table -create function environment() - returns table (nme string, val string) - external name sql.environment; - --- The BAT buffer pool overview -create function bbp () - returns table (id int, name string, htype string, - ttype string, count BIGINT, refcnt int, lrefcnt int, - location string, heat int, dirty string, - status string, kind string) - external name sql.bbp; - --- Change the whereabouts of the log file -create procedure logfile(filename string) - external name sql.logfile; - diff -r e0f2dbc76212 -r f928f414e85d sql/src/sql/bbp.sql --- a/sql/src/sql/bbp.sql Thu May 13 16:57:58 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,19 +0,0 @@ --- The contents of this file are subject to the MonetDB Public License --- Version 1.1 (the "License"); you may not use this file except in --- compliance with the License. You may obtain a copy of the License at --- http://monetdb.cwi.nl/Legal/MonetDBLicense-1.1.html --- --- Software distributed under the License is distributed on an "AS IS" --- basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the --- License for the specific language governing rights and limitations --- under the License. --- --- The Original Code is the MonetDB Database System. --- --- The Initial Developer of the Original Code is CWI. --- Copyright August 2008-2010 MonetDB B.V. --- All Rights Reserved. - -create function bbp () - returns table (id int, name string, htype string, ttype string, count BIGINT, refcnt int, lrefcnt int, location string, heat int, dirty string, status string, kind string) - external name sql.bbp; diff -r e0f2dbc76212 -r f928f414e85d sql/src/sql/cache.sql --- a/sql/src/sql/cache.sql Thu May 13 16:57:58 2010 +0200 +++ b/sql/src/sql/cache.sql Thu May 13 19:03:24 2010 +0200 @@ -16,9 +16,6 @@ -- All Rights Reserved. -- The SQL query cache -create function query_cache () +create function queryCache () returns table (query string, count int) external name sql.dump_cache; - ---create function query_clear_cache() --- external name sql.clear_cache; diff -r e0f2dbc76212 -r f928f414e85d sql/src/sql/mtime.sql --- a/sql/src/sql/mtime.sql Thu May 13 16:57:58 2010 +0200 +++ b/sql/src/sql/mtime.sql Thu May 13 19:03:24 2010 +0200 @@ -30,7 +30,7 @@ create function "localtime"( ) returns TIME external name mtime."current_time"; -create function localtimestamp( ) returns TIMESTAMP +create function "localtimestamp"( ) returns TIMESTAMP external name mtime."current_timestamp"; create function local_timezone( ) returns second_interval diff -r e0f2dbc76212 -r f928f414e85d sql/src/sql/stats.sql --- a/sql/src/sql/stats.sql Thu May 13 16:57:58 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ --- The contents of this file are subject to the MonetDB Public License --- Version 1.1 (the "License"); you may not use this file except in --- compliance with the License. You may obtain a copy of the License at --- http://monetdb.cwi.nl/Legal/MonetDBLicense-1.1.html --- --- Software distributed under the License is distributed on an "AS IS" --- basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the --- License for the specific language governing rights and limitations --- under the License. --- --- The Original Code is the MonetDB Database System. --- --- The Initial Developer of the Original Code is CWI. --- Copyright August 2008-2010 MonetDB B.V. --- All Rights Reserved. - --- show the optimizer statistics maintained by the SQL frontend -create function optimizer_stats () - returns table (rewrite string, count int) - external name sql.dump_opt_stats; diff -r e0f2dbc76212 -r f928f414e85d sql/src/sql/times.sql --- a/sql/src/sql/times.sql Thu May 13 16:57:58 2010 +0200 +++ b/sql/src/sql/times.sql Thu May 13 19:03:24 2010 +0200 @@ -15,6 +15,7 @@ -- All Rights Reserved. -- Provide a simple equivalent for the UNIX times command +-- times 0 ms user 0 ms system 0 ms 0 reads 0 writes create procedure times() external name sql.times; diff -r e0f2dbc76212 -r f928f414e85d sql/src/sql/url.sql --- a/sql/src/sql/url.sql Thu May 13 16:57:58 2010 +0200 +++ b/sql/src/sql/url.sql Thu May 13 19:03:24 2010 +0200 @@ -48,7 +48,7 @@ EXTERNAL NAME url."getRobotURL"; CREATE function isaURL(theUrl url) RETURNS BOOL EXTERNAL NAME url."isaURL"; -CREATE function newurl(protocol STRING, hostname STRING,port INT, file STRING) +CREATE function newurl(protocol STRING, hostname STRING, "port" INT, file STRING) RETURNS url EXTERNAL NAME url."newUrl"; CREATE function newurl(protocol STRING, hostname STRING, file STRING) diff -r e0f2dbc76212 -r f928f414e85d sql/src/test/BugTracker/Tests/caching.SF-1651599.sql --- a/sql/src/test/BugTracker/Tests/caching.SF-1651599.sql Thu May 13 16:57:58 2010 +0200 +++ b/sql/src/test/BugTracker/Tests/caching.SF-1651599.sql Thu May 13 19:03:24 2010 +0200 @@ -2000,7 +2000,7 @@ insert into foo (foo1,foo2,foo3,foo4,foo5,foo6,foo7) select 8845.2051,2817.4110,7383.2817,2051.2817,4110.7383,1571.581,581.1571; insert into foo (foo1,foo2,foo3,foo4,foo5,foo6,foo7) select 5723.4263,4263.9880,9456.4263,4263.4263,9880.9456,7472.5417,5417.7472; insert into foo (foo1,foo2,foo3,foo4,foo5,foo6,foo7) select 2543.5363,9249.8762,9081.9249,5363.9249,8762.9081,8516.5131,5131.8516; -select * from query_cache() cache; +select * from queryCache() cache; drop table foo; commit; diff -r e0f2dbc76212 -r f928f414e85d sql/src/test/Skyserver/Skyserver_dropCache.sql --- a/sql/src/test/Skyserver/Skyserver_dropCache.sql Thu May 13 16:57:58 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -START TRANSACTION; - -DROP FUNCTION query_cache; - -COMMIT; diff -r e0f2dbc76212 -r f928f414e85d sql/src/test/Skyserver/run.all --- a/sql/src/test/Skyserver/run.all Thu May 13 16:57:58 2010 +0200 +++ b/sql/src/test/Skyserver/run.all Thu May 13 19:03:24 2010 +0200 @@ -41,7 +41,6 @@ EOF $SQL < ../../sql/math.sql -$SQL < ../../sql/cache.sql $SQL < ../../sql/skyserver.sql echo tables @@ -63,7 +62,6 @@ $SQL < Skyserver_dropFunctions.sql $SQL < Skyserver_dropMs_functions.sql $SQL < Skyserver_dropMath.sql -$SQL < Skyserver_dropCache.sql $SQL < Skyserver_dropViews.sql $SQL < Skyserver_dropConstraints.sql $SQL < Skyserver_dropTables.sql diff -r e0f2dbc76212 -r f928f414e85d sql/src/test/Skyserver/runv6.all --- a/sql/src/test/Skyserver/runv6.all Thu May 13 16:57:58 2010 +0200 +++ b/sql/src/test/Skyserver/runv6.all Thu May 13 19:03:24 2010 +0200 @@ -40,7 +40,6 @@ echo functions $SQL1 < ../../sql/math.sql -$SQL1 < ../../sql/cache.sql $SQL1 < ../../sql/skyserver.sql $SQL1 < Skyserver_functions_v6.sql @@ -49,7 +48,6 @@ $SQL1 < Skyserver_dropFunctions_v6.sql $SQL1 < Skyserver_dropMs_functions.sql $SQL1 < Skyserver_dropMath.sql -$SQL1 < Skyserver_dropCache.sql $SQL1 < Skyserver_dropViews_v6.sql $SQL1 < Skyserver_dropConstraints_v6.sql $SQL1 < Skyserver_dropTables_v6.sql diff -r e0f2dbc76212 -r f928f414e85d sql/src/test/leaks/Tests/bbp.sql.src --- a/sql/src/test/leaks/Tests/bbp.sql.src Thu May 13 16:57:58 2010 +0200 +++ b/sql/src/test/leaks/Tests/bbp.sql.src Thu May 13 19:03:24 2010 +0200 @@ -1,1 +1,1 @@ -$RELSRCDIR/../../../sql/bbp.sql +$RELSRCDIR/../../../sql/admin.sql _______________________________________________ Checkin-list mailing list [email protected] http://mail.monetdb.org/mailman/listinfo/checkin-list
