Changeset: 265f422d9792 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=265f422d9792
Added Files:
        sql/scripts/18_index.sql
Modified Files:
        sql/backends/monet5/sql.c
        sql/backends/monet5/sql.h
        sql/backends/monet5/sql.mal
        sql/scripts/Makefile.ag
Branch: leftmart
Log Message:

Basic structure for SQL procedure call


diffs (98 lines):

diff --git a/sql/backends/monet5/sql.c b/sql/backends/monet5/sql.c
--- a/sql/backends/monet5/sql.c
+++ b/sql/backends/monet5/sql.c
@@ -4382,6 +4382,41 @@ SQLargRecord(Client cntxt, MalBlkPtr mb,
        return MAL_SUCCEED;
 }
 
+/* Experimental code for dealing with oid indices */
+str
+SQLoidindex(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
+{
+    str *sch = getArgReference_str(stk, pci, 1);
+    str *tbl = getArgReference_str(stk, pci, 2);
+    str *col = getArgReference_str(stk, pci, 3);
+    sql_trans *tr;
+    sql_schema *s;
+    sql_table *t;
+    sql_column *c;
+    mvc *m = NULL;
+    str msg;
+
+    if ((msg = getSQLContext(cntxt, mb, &m, NULL)) != NULL)
+        return msg;
+    if ((msg = checkSQLContext(cntxt)) != NULL)
+        return msg;
+    s = mvc_bind_schema(m, *sch);
+    if (s == NULL)
+        throw(SQL, "sql.oidindex", "3F000!Schema missing");
+    t = mvc_bind_table(m, s, *tbl);
+    if (t == NULL)
+        throw(SQL, "sql.oidindex", "42S02!Table missing");
+    c = mvc_bind_column(m, t, *col);
+    if (c == NULL)
+        throw(SQL, "sql.oidindex", "42S02!Column missing");
+    tr = m->session->tr;
+    t->base.wtime = s->base.wtime = tr->wtime = tr->wstime;
+    t->base.rtime = s->base.rtime = tr->rtime = tr->stime;
+       printf("#About to create the oid index on %s.%s.%s\n", *sch, *tbl, 
*col);
+       
+    return MAL_SUCCEED;
+}
+
 /*
  * Vacuum cleaning tables
  * Shrinking and re-using space to vacuum clean the holes in the relations.
diff --git a/sql/backends/monet5/sql.h b/sql/backends/monet5/sql.h
--- a/sql/backends/monet5/sql.h
+++ b/sql/backends/monet5/sql.h
@@ -130,6 +130,7 @@ sql5_export str SQLdrop_hash(Client cntx
 sql5_export str SQLnewDictionary(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci);
 sql5_export str SQLdropDictionary(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci);
 sql5_export str SQLargRecord(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci);
+sql5_export str SQLoidindex(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci);
 sql5_export str SQLoptimizersUpdate(Client cntxt, MalBlkPtr mb, MalStkPtr stk, 
InstrPtr pci);
 sql5_export str month_interval_str(int *ret, const str *s, const int *ek, 
const int *sk);
 sql5_export str second_interval_str(lng *res, const str *s, const int *ek, 
const int *sk);
diff --git a/sql/backends/monet5/sql.mal b/sql/backends/monet5/sql.mal
--- a/sql/backends/monet5/sql.mal
+++ b/sql/backends/monet5/sql.mal
@@ -566,6 +566,10 @@ command batcalc.hash( b:bat[:oid,:any_1]
 pattern calc.rotate_xor_hash(h:wrd, nbits:int, v:any_1) :wrd address 
MKEYrotate_xor_hash;
 command batcalc.rotate_xor_hash(h:bat[:oid,:wrd], nbits:int, 
b:bat[:oid,:any_1]) :bat[:oid,:int] address MKEYbulk_rotate_xor_hash;
 
+pattern oidindex(sch:str,tab:str,col:str)
+address SQLoidindex
+comment "Create an oid index on a particular column";
+
 command sql.dec_round( v:bte, r:bte ) :bte 
 address bte_dec_round_wrap
 comment "round off the value v to nearests multiple of r";
diff --git a/sql/scripts/18_index.sql b/sql/scripts/18_index.sql
new file mode 100644
--- /dev/null
+++ b/sql/scripts/18_index.sql
@@ -0,0 +1,12 @@
+-- This Source Code Form is subject to the terms of the Mozilla Public
+-- License, v. 2.0.  If a copy of the MPL was not distributed with this
+-- file, You can obtain one at http://mozilla.org/MPL/2.0/.
+--
+-- Copyright 2008-2015 MonetDB B.V.
+
+-- Experimental oid index
+
+create procedure oidindex(sys string, tab string, col string)
+       external name sql.oidindex;
+
+
diff --git a/sql/scripts/Makefile.ag b/sql/scripts/Makefile.ag
--- a/sql/scripts/Makefile.ag
+++ b/sql/scripts/Makefile.ag
@@ -18,6 +18,7 @@ headers_sql = {
                15_querylog.sql \
                16_tracelog.sql \
                17_temporal.sql \
+               18_index.sql \
                20_vacuum.sql \
                21_dependency_functions.sql \
                22_clients.sql \
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to