|
Post by bigbass on Oct 13, 2019 6:10:17 GMT 1
Thanks Peter for the comments and feedback! I was reading a post today that used DATA basic-converter.proboards.com/post/12513and thought to make a correct sqlite3 database that would generate all the tables for fun just to see what are the differences between the two styles and have some working demo code for sqlite3 mixed with bacon sometimes having two examples of the same code helps explain what is happening in more detail this is the scripted version using sqlite3 you could paste it in the terminal # second attempt to place all values in a sqlite database # using the scripted style
sqlite3 data.db
#t_nothing create table Unexplored(zero int ,one int ,two int, three int, four int, five int, six int, seven int, eight int, nine int, ten int ,eleven int ,twelve int ,thirteen int, fourteen int ,fifteen int );
insert into Unexplored values(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); insert into Unexplored values(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); insert into Unexplored values(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); insert into Unexplored values(0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0); insert into Unexplored values(0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0); insert into Unexplored values(0, 0, 0, 0, 0, 2, 2, 2, 2, 6, 2, 0, 0, 0, 0, 0); insert into Unexplored values(0, 0, 0, 0, 0, 0, 2, 2, 6, 2, 0, 0, 0, 0, 0, 0); insert into Unexplored values(0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0); insert into Unexplored values(0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0); insert into Unexplored values(0, 0, 0, 0, 0, 0, 2, 6, 2, 2, 0, 0, 0, 0, 0, 0); insert into Unexplored values(0, 0, 0, 0, 0, 2, 6, 2, 2, 2, 2, 0, 0, 0, 0, 0); insert into Unexplored values(0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0, 0); insert into Unexplored values(0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0); insert into Unexplored values(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); insert into Unexplored values(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); insert into Unexplored values(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
.separator ", " .output Unexplored.txt select * from Unexplored;
# t_mountain create table Mountain(zero int ,one int ,two int, three int, four int, five int, six int, seven int, eight int, nine int, ten int ,eleven int ,twelve int ,thirteen int, fourteen int ,fifteen int );
insert into Mountain values(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); insert into Mountain values(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); insert into Mountain values(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); insert into Mountain values(0, 0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); insert into Mountain values(0, 0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); insert into Mountain values(0, 0, 0, 4, 4, 4, 4, 0, 0, 0, 4, 4, 0, 0, 0, 0); insert into Mountain values(0, 0, 0, 4, 4, 4, 4, 0, 0, 0, 4, 4, 0, 0, 0, 0); insert into Mountain values(0, 0, 4, 4, 4, 4, 4, 4, 0, 4, 4, 4, 4, 0, 0, 0); insert into Mountain values(0, 0, 4, 4, 4, 4, 4, 0, 0, 4, 4, 4, 4, 0, 0, 0); insert into Mountain values(0, 4, 4, 4, 4, 4, 4, 0, 4, 4, 4, 4, 4, 4, 0, 0); insert into Mountain values(0, 4, 4, 4, 4, 4, 0, 0, 4, 4, 4, 4, 4, 4, 0, 0); insert into Mountain values(0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 0); insert into Mountain values(0, 0, 0, 0, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 0); insert into Mountain values(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); insert into Mountain values(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
.separator ", " .output Mountain.txt select * from Mountain;
#t_forest create table Forest(zero int ,one int ,two int, three int, four int, five int, six int, seven int, eight int, nine int, ten int ,eleven int ,twelve int ,thirteen int, fourteen int ,fifteen int );
insert into Forest values(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); insert into Forest values(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); insert into Forest values(0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); insert into Forest values(0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0); insert into Forest values(0, 0, 0, 0, 3, 3, 3, 0, 0, 0, 0, 0, 3, 0, 0, 0); insert into Forest values(0, 0, 0, 0, 3, 3, 3, 0, 0, 0, 0, 3, 3, 3, 0, 0); insert into Forest values(0, 0, 0, 3, 3, 3, 3, 3, 0, 0, 0, 3, 3, 3, 0, 0); insert into Forest values(0, 0, 0, 3, 3, 3, 3, 3, 0, 0, 3, 3, 3, 3, 3, 0); insert into Forest values(0, 0, 3, 3, 3, 3, 3, 3, 3, 0, 0, 0, 1, 0, 0, 0); insert into Forest values(0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0); insert into Forest values(0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0); insert into Forest values(0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); insert into Forest values(0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); insert into Forest values(0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); insert into Forest values(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); insert into Forest values(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
.separator ", " .output Forest.txt select * from Forest;
#t_lake
create table Lake(zero int ,one int ,two int, three int, four int, five int, six int, seven int, eight int, nine int, ten int ,eleven int ,twelve int ,thirteen int, fourteen int ,fifteen int );
insert into Lake values(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); insert into Lake values(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); insert into Lake values(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); insert into Lake values(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); insert into Lake values(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); insert into Lake values(0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0); insert into Lake values(0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0); insert into Lake values(0, 2, 2, 2, 6, 2, 6, 2, 2, 2, 2, 2, 2, 2, 2, 0); insert into Lake values(2, 2, 2, 2, 2, 6, 2, 2, 2, 2, 2, 6, 2, 6, 2, 2); insert into Lake values(2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 6, 2, 2, 2); insert into Lake values(0, 2, 2, 2, 2, 2, 2, 6, 2, 6, 2, 2, 2, 2, 2, 0); insert into Lake values(0, 0, 2, 2, 2, 2, 2, 2, 6, 2, 2, 2, 2, 2, 0, 0); insert into Lake values(0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 0, 0); insert into Lake values(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); insert into Lake values(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); insert into Lake values(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
.separator ", " .output Lake.txt select * from Lake;
create table Village(zero int ,one int ,two int, three int, four int, five int, six int, seven int, eight int, nine int, ten int ,eleven int ,twelve int ,thirteen int, fourteen int ,fifteen int ); insert into Village values(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); insert into Village values(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); insert into Village values(0, 0, 0, 0, 0, 0, 0, 5, 5, 0, 0, 0, 0, 0, 0, 0); insert into Village values(0, 0, 0, 0, 0, 0, 5, 5, 5, 5, 0, 0, 0, 0, 0, 0); insert into Village values(0, 0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0, 0); insert into Village values(0, 0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0, 0); insert into Village values(0, 0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0, 0); insert into Village values(0, 0, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 0, 0); insert into Village values(0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0); insert into Village values(0, 0, 0, 0, 7, 2, 2, 7, 7, 7, 7, 7, 0, 0, 0, 0); insert into Village values(0, 0, 0, 0, 7, 2, 2, 7, 7, 7, 7, 7, 0, 0, 0, 0); insert into Village values(0, 0, 0, 0, 7, 7, 7, 7, 7, 1, 1, 7, 0, 0, 0, 0); insert into Village values(0, 0, 0, 0, 7, 7, 7, 7, 7, 1, 1, 7, 0, 0, 0, 0); insert into Village values(0, 0, 0, 0, 7, 7, 7, 7, 7, 1, 1, 7, 0, 0, 0, 0); insert into Village values(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); insert into Village values(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
.separator ", " .output Village.txt select * from Village;
create table Rubble(zero int ,one int ,two int, three int, four int, five int, six int, seven int, eight int, nine int, ten int ,eleven int ,twelve int ,thirteen int, fourteen int ,fifteen int ); insert into Rubble values(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
insert into Rubble values(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); insert into Rubble values(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); insert into Rubble values(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); insert into Rubble values(0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0); insert into Rubble values(0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0); insert into Rubble values(0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); insert into Rubble values(0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); insert into Rubble values(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0); insert into Rubble values(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0); insert into Rubble values(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0); insert into Rubble values(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); insert into Rubble values(0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0); insert into Rubble values(0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0); insert into Rubble values(0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0); insert into Rubble values(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); insert into Rubble values(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
.separator ", " .output Rubble.txt select * from Rubble;
.exit
and bacon could use this for testing the files or images printbindata.bac
'---vovchik suggested using BLOAD '---there wasnt a full demo so I hope got the idea right DECLARE binary TYPE unsigned char* DECLARE binsize TYPE long DECLARE binfile$ TYPE STRING
SUB UNEXPLORED binfile$ = "Unexplored.txt" binary = BLOAD(binfile$) PRINT binary PRINT END SUB
SUB MOUNTAIN binfile$ = "Mountain.txt" binary = BLOAD(binfile$) PRINT binary PRINT END SUB
SUB FOREST binfile$ = "Forest.txt" binary = BLOAD(binfile$) PRINT binary PRINT END SUB
SUB LAKE binfile$ = "Lake.txt" binary = BLOAD(binfile$) PRINT binary PRINT END SUB
SUB VILLAGE binfile$ = "Village.txt" binary = BLOAD(binfile$) PRINT binary PRINT END SUB
SUB RUBBLE binfile$ = "Rubble.txt" binary = BLOAD(binfile$) PRINT binary END SUB
CALL MOUNTAIN CALL FOREST CALL LAKE CALL VILLAGE CALL RUBBLE
|
|