-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
287 additions
and
295 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,12 +31,9 @@ jobs: | |
- name: Install Rebol for extension test | ||
uses: oldes/[email protected] | ||
|
||
- name: Test SQLite raw extension | ||
- name: Test SQLite extension | ||
run: ./rebol3 ci-test.r3 | ||
|
||
- name: Test SQLite scheme | ||
run: ./rebol3 sqlite-scheme.r3 | ||
|
||
############################################################################### | ||
# Collecting build artifacts... | ||
- uses: actions/upload-artifact@v3 | ||
|
@@ -77,12 +74,9 @@ jobs: | |
- name: Install Rebol for extension test | ||
uses: oldes/[email protected] | ||
|
||
- name: Test SQLite raw extension | ||
- name: Test SQLite extension | ||
run: ./rebol3 ci-test.r3 | ||
|
||
- name: Test SQLite scheme | ||
run: ./rebol3 sqlite-scheme.r3 | ||
|
||
- name: Compress 64bit Rebol SQLite extension | ||
run: gzip -9 ./sqlite-linux-x64.rebx | ||
|
||
|
@@ -109,12 +103,9 @@ jobs: | |
- name: Install Rebol for extension test | ||
uses: oldes/[email protected] | ||
|
||
- name: Test SQLite raw extension | ||
- name: Test SQLite extension | ||
run: ./rebol3 ci-test.r3 | ||
|
||
- name: Test SQLite scheme | ||
run: ./rebol3 sqlite-scheme.r3 | ||
|
||
- name: Compress 64bit Rebol SQLite extension | ||
run: gzip -9 ./sqlite-macos-x64.rebx | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,4 @@ | |
!README.md | ||
!LICENSE | ||
!ci-test.r3 | ||
!sqlite-scheme.r3 | ||
!sqlite-scheme.reb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -187,5 +187,126 @@ COMMIT;} | |
print info | ||
print "SQLite tests done." | ||
] | ||
|
||
|
||
;------------------------------------------------------------------------------------------------ | ||
print-horizontal-line | ||
print as-yellow "SQLITE SCHEME TESTS" | ||
print-horizontal-line | ||
|
||
import %sqlite-scheme.reb | ||
|
||
if exists? %chinook.db [ | ||
db: open/new sqlite:chinook.db | ||
|
||
probe read insert db {SELECT | ||
InvoiceId, | ||
BillingAddress, | ||
date(InvoiceDate) InvoiceDate, | ||
Total | ||
FROM | ||
invoices | ||
WHERE | ||
InvoiceDate NOT BETWEEN '2009-01-03' AND '2013-12-01' | ||
ORDER BY | ||
InvoiceDate; | ||
} | ||
] | ||
|
||
;open sqlite:new.db ;; would throw an error, if the file ./new.db does not exists | ||
;open sqlite:/home/oldes/new.db ;; used full path to the DB file | ||
|
||
print-horizontal-line | ||
prin as-yellow "Testing an error message, when trying to open a database using not existing dir." | ||
print try [open/new sqlite:not-exists/dir] | ||
|
||
;; Create a new DB file in the current dir, if it does not exists, and open it | ||
db: open/new sqlite:new.db | ||
|
||
;; Allow verbose SQLite traces... | ||
modify db 'trace-level 3 ;= SQLITE_TRACE_STMT or SQLITE_TRACE_PROFILE | ||
|
||
;; Execute multiple queries at once... | ||
write db { | ||
BEGIN TRANSACTION; | ||
/* delete any tables used in the test */ | ||
DROP TABLE IF EXISTS t1; | ||
DROP TABLE IF EXISTS t2; | ||
DROP TABLE IF EXISTS Cars; | ||
DROP TABLE IF EXISTS Contacts; | ||
/* ---------------------------------- */ | ||
CREATE TABLE Cars(Id INTEGER PRIMARY KEY, Name TEXT, Price INTEGER); | ||
INSERT INTO "Cars" VALUES(1,'Audi',52642); | ||
INSERT INTO "Cars" VALUES(2,'Mercedes',57127); | ||
INSERT INTO "Cars" VALUES(3,'Skoda',9000); | ||
INSERT INTO "Cars" VALUES(4,'Volvo',29000); | ||
INSERT INTO "Cars" VALUES(5,'Bentley',350000); | ||
INSERT INTO "Cars" VALUES(6,'Citroen',21000); | ||
INSERT INTO "Cars" VALUES(7,'Hummer',41400); | ||
INSERT INTO "Cars" VALUES(NULL,'Audi',52642); | ||
INSERT INTO "Cars" VALUES(NULL,'Mercedes',57127); | ||
INSERT INTO "Cars" VALUES(NULL,'Skoda',9000); | ||
INSERT INTO "Cars" VALUES(NULL,'Volvo',29000); | ||
INSERT INTO "Cars" VALUES(NULL,'Bentley',350000); | ||
INSERT INTO "Cars" VALUES(NULL,'Citroen',21000); | ||
INSERT INTO "Cars" VALUES(NULL,'Hummer',41400); | ||
INSERT INTO "Cars" VALUES(NULL,'Audi',52642); | ||
INSERT INTO "Cars" VALUES(NULL,'Mercedes',57127); | ||
INSERT INTO "Cars" VALUES(NULL,'Skoda',9000); | ||
INSERT INTO "Cars" VALUES(NULL,'Volvo',29000); | ||
INSERT INTO "Cars" VALUES(NULL,'Bentley',350000); | ||
INSERT INTO "Cars" VALUES(NULL,'Citroen',21000); | ||
INSERT INTO "Cars" VALUES(NULL,'Hummer',41400); | ||
INSERT INTO "Cars" VALUES(NULL,'Audi',52642); | ||
INSERT INTO "Cars" VALUES(NULL,'Mercedes',57127); | ||
INSERT INTO "Cars" VALUES(NULL,'Skoda',9000); | ||
INSERT INTO "Cars" VALUES(NULL,'Volvo',29000); | ||
INSERT INTO "Cars" VALUES(NULL,'Bentley',350000); | ||
INSERT INTO "Cars" VALUES(NULL,'Citroen',21000); | ||
INSERT INTO "Cars" VALUES(NULL,'Hummer',41400); | ||
INSERT INTO "Cars" VALUES(NULL,'Audi',52642); | ||
INSERT INTO "Cars" VALUES(NULL,'Mercedes',57127); | ||
INSERT INTO "Cars" VALUES(NULL,'Skoda',9000); | ||
INSERT INTO "Cars" VALUES(NULL,'Volvo',29000); | ||
INSERT INTO "Cars" VALUES(NULL,'Bentley',350000); | ||
INSERT INTO "Cars" VALUES(NULL,'Citroen',21000); | ||
INSERT INTO "Cars" VALUES(NULL,'Hummer',41400); | ||
CREATE TABLE Contacts ( | ||
email TEXT PRIMARY KEY, | ||
first_name TEXT NOT NULL, | ||
last_name TEXT NOT NULL | ||
); | ||
INSERT INTO "Contacts" VALUES('[email protected]', 'Océane', 'Pacôme'); | ||
INSERT INTO "Contacts" VALUES('[email protected]','Oldes', 'Huhuman'); | ||
COMMIT; | ||
} | ||
|
||
print-horizontal-line | ||
prin as-yellow "Testing an error message of the invalid query." | ||
print try [insert db "INVALID_QUERY"] | ||
|
||
print-horizontal-line | ||
|
||
insert db "SELECT * FROM Cars" ;; Prepares a statement | ||
print as-yellow "Resolving 10 rows one by one..." | ||
loop 10 [probe take db] | ||
print as-yellow "Resolving 5 rows at once..." | ||
probe read/part db 5 | ||
print as-yellow "Resolving the rest of rows..." | ||
probe read db | ||
|
||
print-horizontal-line | ||
print as-yellow "Resolving 4 random hexadecimal blobs" | ||
insert db "SELECT hex(randomblob(16)), hex(randomblob(16)), hex(randomblob(16)), hex(randomblob(16))" | ||
probe read db | ||
|
||
print-horizontal-line | ||
print as-yellow "Resolving all data using PICK action" | ||
probe pick db "SELECT * FROM Contacts" | ||
|
||
|
||
print as-yellow "DONE" | ||
|
||
;quit | ||
|
Oops, something went wrong.