Changeset: 3fa1a66ed418 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=3fa1a66ed418
Added Files:
        sql/test/sciql2sql/Tests/update_step_int_array.sql
Modified Files:
        sql/test/sciql2sql/Tests/All
Branch: SciQL-2
Log Message:

Update over partial bound array


diffs (83 lines):

diff --git a/sql/test/sciql2sql/Tests/All b/sql/test/sciql2sql/Tests/All
--- a/sql/test/sciql2sql/Tests/All
+++ b/sql/test/sciql2sql/Tests/All
@@ -1,15 +1,16 @@
 # declaration of integer arrays
 create_fixed_arrays
 create_range_arrays
-create_unbound_array.sql
-create_step_int_array.sql
-create_step_flt_array.sql
-create_unbound_step_array.sql
+create_unbound_array
+create_step_int_array
+create_step_flt_array
+create_unbound_step_array
 
-# update non-dimensional attributes
+# update attributes
 update_fixed_array
+#update_range_array covered by fixed_array
 update_unbound_array
-# update dimensional attributes
+update_step_int_array
 
 # selections with target is relation
 
diff --git a/sql/test/sciql2sql/Tests/update_step_int_array.sql 
b/sql/test/sciql2sql/Tests/update_step_int_array.sql
new file mode 100644
--- /dev/null
+++ b/sql/test/sciql2sql/Tests/update_step_int_array.sql
@@ -0,0 +1,52 @@
+-- Update of arrays with unspecified final bounds
+CREATE ARRAY array1Dint(x INTEGER DIMENSION[0:1:4], v INTEGER DEFAULT 1);
+SELECT * FROM array1Dint;
+DROP ARRAY array1Dint;
+
+-- relational equivalent is a fixed array initialization
+CREATE TABLE array1Dint(x INTEGER, v INTEGER DEFAULT 1);
+INSERT INTO array1Dint VALUES
+(0,1),
+(1,1),
+(2,1),
+(3,1);
+SELECT * FROM array1Dint;
+DROP TABLE array1Dint;
+
+-- partially bounded arrays get their implicit temporary dimension using 
updates
+CREATE ARRAY array1Dint(x INTEGER DIMENSION[0:1:*], v INTEGER DEFAULT 1);
+SELECT * FROM array1Dint;
+DROP ARRAY array1Dint;
+
+-- we know that at least one element is defined
+CREATE TABLE array1Dint(x INTEGER, v INTEGER DEFAULT 1);
+INSERT INTO array1Dint VALUES (0,1);
+SELECT * FROM array1Dint;
+DROP TABLE array1Dint;
+
+-- appending values extend the list
+-- update of intermediates is straightforward
+CREATE ARRAY array1Dint(x INTEGER DIMENSION[0:1:*], v INTEGER DEFAULT 1);
+INSERT INTO array1Dint VALUES(3,2); -- extend the bound
+SELECT * FROM array1Dint;
+UPDATE array1Dint SET v= 44;
+SELECT * FROM array1Dint;
+DELETE FROM array1Dint WHERE x =2;
+SELECT * FROM array1Dint;
+DROP ARRAY array1Dint;
+
+CREATE TABLE array1Dint(x INTEGER, v INTEGER DEFAULT 1);
+INSERT INTO array1Dint VALUES (0,1);
+INSERT INTO array1Dint VALUES(3,2); -- extend the bound
+-- fill it up
+INSERT INTO array1Dint VALUES (1,1), (2,1);
+SELECT * FROM array1Dint ORDER BY x;
+UPDATE array1Dint SET v= 44;
+SELECT * FROM array1Dint ORDER BY x;
+UPDATE array1Dint SET v = 1 WHERE x =2;
+SELECT * FROM array1Dint ORDER BY x;
+DROP TABLE array1Dint;
+
+-- semantic errors preferrably catched
+CREATE ARRAY array1Dint(x INTEGER DIMENSION[0:1:4], v INTEGER DEFAULT 1); 
+DROP ARRAY array1Dint;
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to