From b8157f5fcce9c034538fea6fc3cb55a0efcafd3b Mon Sep 17 00:00:00 2001 From: Paul Reeves Date: Thu, 26 Jan 2023 20:48:31 +0100 Subject: [PATCH] Add some test data to test blob load and save --- test/testudrkit-testdata.dml | 13 +++++++++++- test/testudrkit.ddl | 40 +++++++++++++++++++++++++++++++++++- 2 files changed, 51 insertions(+), 2 deletions(-) diff --git a/test/testudrkit-testdata.dml b/test/testudrkit-testdata.dml index b606c14..716f5bd 100644 --- a/test/testudrkit-testdata.dml +++ b/test/testudrkit-testdata.dml @@ -4,8 +4,19 @@ insert into test_div(numerator, denominator) values (10000000, 3); insert into test_div(numerator, denominator) values (987654321000, 7); commit; +/* +This is known to fail. Uncomment as required. set bail off; insert into test_div(numerator, denominator) values (9876543210000000000, 7); set bail on; - +*/ commit; + + + +insert into test_blobs( description, file_type, source_file ) values ('boot readme', 'txt', '/boot/readme'); +insert into test_blobs( description, file_type, source_file ) values ('xman.help', 'txt', '/usr/share/X11/xman.help'); +insert into test_blobs( description, file_type, source_file ) values ('computer', 'bin', '/usr/share/icons/Adwaita/48x48/devices/computer.png'); +insert into test_blobs( description, file_type, source_file ) values ('git gui icon', 'bin', '/usr/share/git-gui/lib/git-gui.ico'); + + diff --git a/test/testudrkit.ddl b/test/testudrkit.ddl index be8ffec..f845ec7 100644 --- a/test/testudrkit.ddl +++ b/test/testudrkit.ddl @@ -3,7 +3,7 @@ */ -create sequence test_div_seq; +--create sequence test_div_seq; commit; create domain D_ID as BIGINT; create domain D_BIGINT as BIGINT; @@ -13,9 +13,47 @@ create table test_div( , numerator D_BIGINT , denominator D_BIGINT , result COMPUTED BY ( DIV(numerator, denominator) ) + , constraint pk_test_div_id primary key (test_div_id) using index idx_test_div_id + ); commit; +-- create sequence test_blobs_seq; + +create domain D_BLOB as BLOB; +create domain D_DESCRIPTION varchar(255) default 'No description entered' not null ; +create domain D_FILETYPE char(3) default 'BIN' not null check (value in ( 'BIN', 'TXT') ); +create domain D_PATH as varchar(8189) default '' not null ; +create domain D_STATUS as CHAR(1) default 'U' not null check (VALUE IN ('U', 'F', 'L', 'W')); +comment on domain D_STATUS is 'unset, failed, loaded, written'; + +create table test_blobs( + test_blobs_id d_id generated always as identity + , description D_DESCRIPTION + , file_type D_FILETYPE + , source_file D_PATH + , source_status D_STATUS + , target_file D_PATH + , target_status D_STATUS + , the_blob D_BLOB + , constraint pk_test_blobs_id primary key (test_blobs_id) using index idx_test_blobs_id +); + +set term ^; +create trigger t_iub_test_blobs for test_blobs before insert or update +as begin + + new.file_type = upper(new.file_type); + new.source_status = upper(new.source_status); + new.target_status = upper(new.target_status); + +end ^ + + + +set term ;^ + +