sql

storm, sqlite and string representation

Arghhh today I've discovered reading this bug report that specifying strings are RawStr() in strom, they are actually stored as blobs in sqlite3. The very bad side-effect is that string comparison does not work !!!

The right way to store strings with storm is to use the Unicode() data type instead and to wrap all your strings with the unicode function. If you need "utf-8", you can pass it as optional argument to it. Now string comparisons are 10 times faster !!!!!!!! Argggg

select time intervals in sql

consider the following example :

CREATE TABLE elem (
    id INTEGER,
    name VARCHAR,
    num INTEGER
);
CREATE TABLE proxy (
    elem_id INTEGER,
    time_id INTEGER
);
CREATE TABLE time (
    id INTEGER,
    timestamp DATESTAMP
);

INSERT INTO elem VALUES (0,"one",1);
INSERT INTO elem VALUES (1,"one",2);
INSERT INTO elem VALUES (2,"one",3);
INSERT INTO elem VALUES (3,"two",1);

INSERT INTO proxy VALUES (0,0);
INSERT INTO proxy VALUES (0,1);
INSERT INTO proxy VALUES (1,2);
INSERT INTO proxy VALUES (1,3);
INSERT INTO proxy VALUES (2,4);
INSERT INTO

sql insert using a select and a static value

This is just for reference. I forgot the syntax already twice. The insert query does not work if you use parenthesis.


create table test ( a int , b int) ;
create table test1 ( c int) ;
insert into test1 values 1;
insert into test1 values 2;
insert into test1 values 3;
insert into test1 values 4;

insert into test (a,b) select c,0 from test1;
select * from test;
1|0
2|0
4|0
3|0

Syndicate content