/*
sure mode, no confirmation prompt
clearing directory INTERNAL_FILES_DIR (../STORAGE/INT) ...
done
clearing directory MAX_PERF_FILES_DIR (../STORAGE/MAX_PERF) ...
done
clearing directory TRANSAC_FILES_DIR (../STORAGE/TRANSAC) ...
done
*/
Transac sql
SB is not a transactionnal database, but there is small transactionnal mode in SB
This mode can be used to store users, messages
The goal is to avoid having another database for that
Corruption is possible in bi mode, but it is not possible in transac mode
Update with sql in possible in transac mode but not in bi mode
Parameters TCP_PORT_TRANSAC and TRANSAC_FILES_DIR must be set in stormbase.conf
create
create table table_name(col1 text, col2 text, ...)
create table tb_message(id text, json text, status text);
insert
insert into table_name('txt1', 'txt2', ...)
insert into tb_message values('AAA','text AAA',1);
insert into tb_message values('BBB','text BBB','1');
insert into tb_message values('CCC','text BBB1','1');
insert
select <*|col1, col2, ...> from table_name
<|where col1='txt1' and col2='txt2' ...>
select * from tb_message;
| id | json | status |
| AAA | text AAA | 1 |
| BBB | text BBB | 1 |
| CCC | text BBB1 | 1 |
select id, json, id, status from tb_message where id='CCC' and status=2;
update
update table_name set col1='txt1', col2='txt2'
<|where col1='txt1' and col2='txt2' ...>
update tb_message set status='2', json='new' where id='AAA';
update tb_message set status='2', json='newCCC' where id='CCC';
select * from tb_message;
| id | json | status |
| AAA | new | 2 |
| BBB | text BBB | 1 |
| CCC | newCCC | 2 |
select id, json, id, status from tb_message where id='CCC' and status=2;
| id | json | id | status |
| CCC | newCCC | CCC | 2 |
delete
delete table_name
<|where col1='txt1' and col2='txt2' ...>
delete tb_message where id='AAA';
select * from tb_message;
| id | json | status |
| BBB | text BBB | 1 |
| CCC | newCCC | 2 |
delete tb_message;
select * from tb_message;
delete tb_message;
shutdown;