diff --git a/main.cpp b/main.cpp index 49c4257..f128100 100644 --- a/main.cpp +++ b/main.cpp @@ -126,11 +126,11 @@ void repl() { } void debug() { - std::vector sql_commands{ -//"create table history_dividends (symbol varchar(8), ex_date date, pay_date date, div_rate float)", -//"set 'DATE_FORMAT' = '%m/%d/%Y' ", -//"insert into history_dividends (symbol,ex_date,pay_date,div_rate) values ('symbol', 'ex-date', 'pay-date', 0.1)", -//zpusobi crash "insert into history_dividends (symbol,ex_date,pay_date,div_rate) values ('symbol', ex-date, pay-date)" + std::vector sql_commands { +// "create table history_dividends (symbol varchar(8), ex_date date, pay_date date, div_rate float)", +// "set 'DATE_FORMAT' = '%m/%d/%Y' ", +// "insert into history_dividends (symbol,ex_date,pay_date,div_rate) values ('symbol', 'ex-date', 'pay-date', 0.1)", +// "insert into history_dividends (symbol,ex_date,pay_date,div_rate) values ('symbol', ex-date, pay-date)" // "create table ticker ( tablee varchar(5) not null, permaticker integer, ticker varchar(10) not null, name varchar(256) not null, exchange varchar(32), isdelisted boolean, category varchar(32), cusips varchar(256), siccode integer, sicsector varchar(256), sicindustry varchar(256), famasector varchar(256), famaindustry varchar(256), sector varchar(128), industry varchar(128), scalemarketcap varchar(64), scalerevenue varchar(64), relatedtickers varchar(128), currency varchar(3), location varchar(64), lastupdated date, firstadded date, firstpricedate date, lastpricedate date, firstquarter date, lastquarter date, secfilings varchar(256), companysite varchar(256))", // "load ticker from '/Users/vaclavt/Library/Mobile Documents/com~apple~CloudDocs/Development/usql/tickers.csv')", // "select * from ticker where ticker = 'WFC' and tablee = 'SF1'", @@ -147,28 +147,28 @@ void debug() { "create table a (i integer not null, s varchar(64), f float null, d date null, b boolean)", "insert into a (i, s, b) values(1, upper('zero'), 'Y')", "insert into a (i, s, b, f) values(1 + 10000, upper('one'), 'N', 3.1415)", - "insert into a (i, s, f) values(2 + 10000, upper('two'), 3.1415)", - "select min(i), max(i), count(*) from a where b is not null", - "select * from a where b is null", - "select * from a where b is not null", - "select * from a where b='N'", - "update a set i = i * 100, f = f + 0.01 where i > 1", - "select to_string(i, '%d.%m.%Y %H:%M:%S'), i, s from a where i < to_date('20.12.2019', '%d.%m.%Y')", - "select i + 2 as first, i, s, b, f from a where i >=1 order by 1 desc offset 0 limit 1", + "insert into a (i, s, f) values(2 + 10000, upper('two'), 9.1415)", + "select * from a order by i", + // "select min(i), max(f), count(*) from a where b is not null", + // "select * from a where b is null", + // "select * from a where b is not null", + // "select * from a where b='N'", + // "update a set i = i * 100, f = f + 0.01 where i > 1", + // "select to_string(i, '%d.%m.%Y %H:%M:%S'), i, s from a where i < to_date('20.12.2019', '%d.%m.%Y')", + // "select i + 2 as first, i, s, b, f from a where i >=1 order by 1 desc offset 0 limit 1", - - "update table a set s = 'null string aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'", - "update table a set i = null", - "insert into a (i, s) values(2, 'two')", - "insert into a (i, s) values(3, 'two')", - "insert into a (i, s) values(4, lower('FOUR'))", - "insert into a (i, s) values(5, 'five')", - "insert into a (i, s) values(to_date('20.12.1973', '%d.%m.%Y'), 'six')", + // "update table a set s = 'null string aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'", + // "update table a set i = null", + // "insert into a (i, s) values(2, 'two')", + // "insert into a (i, s) values(3, 'two')", + // "insert into a (i, s) values(4, lower('FOUR'))", + // "insert into a (i, s) values(5, 'five')", + // "insert into a (i, s) values(to_date('20.12.1973', '%d.%m.%Y'), 'six')", // tohle zpusobi kresh "insert into a (i, d) values(6', '2006-10-04')", - "insert into a (i, d) values(6, '2006-10-04')", - "save table a into '/tmp/a.csv'", - "select i, s from a where i > 2 order by 1 desc offset 1 limit 1", - "select distinct s, d from a", + // "insert into a (i, d) values(6, '2006-10-04')", + // "save table a into '/tmp/a.csv'", + // "select i, s from a where i > 2 order by 1 desc offset 1 limit 1", + // "select distinct s, d from a", // "select i, s from a where i = 1", // "select i, s from a where s = 'two'", // "select i, s from a where i <= 3 and s = 'one'", @@ -211,10 +211,14 @@ void debug() { std::cout << std::endl << std::endl; } + int main(int argc, char *argv[]) { +#ifdef NDEBUG + repl(); +#else debug(); - // repl(); +#endif return 0; }