a bit of work on conversion functions

This commit is contained in:
vaclavt
2022-04-03 16:46:39 +02:00
parent aca52899fb
commit dadad69958
7 changed files with 81 additions and 25 deletions

27
debug.h
View File

@@ -15,22 +15,22 @@ std::vector<std::string> k_debug_sql_commands {
// "create index sf1_symbol on sf1(symbol)",
// "load into sf1 '/srv/SHARADAR_SF1.csv'",
// "set 'USE_INDEXSCAN' = 'false'",
// "select dimension, to_string(calendar_date, '%d.%m.%Y'), pp(eps, \"%.2f\"), pp(shareswadil), pp(revenue), pp(netinc), pp(cashneq), pp(assets), pp(debt), pp(ncfdebt), pp(roe*100), pp(intangibles), calendar_date from sf1 where symbol = 'MU' and dimension = 'ARQ' order by dimension, calendar_date desc limit 5",
// "select dimension, to_char(calendar_date, '%d.%m.%Y'), pp(eps, \"%.2f\"), pp(shareswadil), pp(revenue), pp(netinc), pp(cashneq), pp(assets), pp(debt), pp(ncfdebt), pp(roe*100), pp(intangibles), calendar_date from sf1 where symbol = 'MU' and dimension = 'ARQ' order by dimension, calendar_date desc limit 5",
// "set 'USE_INDEXSCAN' = 'true'",
// "select dimension, to_string(calendar_date, '%d.%m.%Y'), pp(eps, \"%.2f\"), pp(shareswadil), pp(revenue), pp(netinc), pp(cashneq), pp(assets), pp(debt), pp(ncfdebt), pp(roe*100), pp(intangibles), calendar_date from sf1 where symbol = 'MU' and dimension = 'ARQ' order by dimension, calendar_date desc limit 5",
// "select dimension, to_char(calendar_date, '%d.%m.%Y'), pp(eps, \"%.2f\"), pp(shareswadil), pp(revenue), pp(netinc), pp(cashneq), pp(assets), pp(debt), pp(ncfdebt), pp(roe*100), pp(intangibles), calendar_date from sf1 where symbol = 'MU' and dimension = 'ARQ' order by dimension, calendar_date desc limit 5",
// "select max(calendar_date), calendar_date from sf1 where symbol = 'MU' and dimension = 'ARQ'",
// "select max(calendar_date), min(calendar_date) from sf1 where symbol = 'MU' and dimension = 'ARQ'"
"create table a (i integer not null, s varchar(64))",
"create index a_i on a(i)",
// "create table a (i integer not null, s varchar(64))",
// "create index a_i on a(i)",
// "insert into a (i, s) values(1, 'one')",
// "insert into a (i, s) values(2, 'two')",
// "insert into a (i, s) values(2, 'second two')",
// "insert into a (i, s) values(3, 'three')",
// "insert into a (i, s) values(4, 'four')",
"insert into a (i) values(5)",
"save a into '/tmp/a.csv'",
"set 'USE_INDEXSCAN' = 'true'",
// "insert into a (i) values(5)",
// "save a into '/tmp/a.csv'",
// "set 'USE_INDEXSCAN' = 'true'",
// "select * from a where 1 = i",
// "delete from a where i = 2 and s ='two'",
// "select * from a where i = 2",
@@ -40,6 +40,17 @@ std::vector<std::string> k_debug_sql_commands {
// "select min(i), max(i), count(i) from a",
// "select i + 1000 from a",
// "select i, s from a where i = 5",
"select i, s, coalesce(s, i) from a where i = 5"
// "select i, s, coalesce(s, i) from a where i = 5",
// "create table a (i float, j float)",
// "insert into a (i, j) values(null, 123456789.12345)",
// "select pp(coalesce(i, j)) from a",
"create table d (datetime date)",
"insert into d (datetime) values(1648634993)",
"select to_char(datetime, '%Y%m%d') from d",
"select to_int(datetime) from d",
"select max(to_char(datetime, '%Y%m%d')) from d",
"select max(to_int(to_float(to_char(datetime, '%Y%m%d')))) from d"
};