wip
This commit is contained in:
parent
a1b3b0140f
commit
427a3a9f04
|
|
@ -4,6 +4,8 @@ set(CMAKE_CXX_STANDARD 17)
|
|||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
# set(CMAKE_CXX_FLAGS "-O3 -Wall -Wextra")
|
||||
|
||||
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.14")
|
||||
|
||||
|
||||
|
|
@ -20,4 +22,3 @@ add_executable(${PROJECT_NAME} ${SOURCE})
|
|||
|
||||
target_link_libraries(${PROJECT_NAME} stdc++ m)
|
||||
|
||||
target_compile_options(usql PRIVATE -g)
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
- is null | is not null
|
||||
- coalesce, date functions now, add_date; string functions rtrim, ltrim, rpad, lpad; math function round
|
||||
- add pipe | concatenation
|
||||
- add support for 1_000_000 numbers
|
||||
|
||||
- support for order by, offset, limit (allow column name in order by, validate)
|
||||
- support for uniqueue indexes (primary key)
|
||||
|
|
@ -13,5 +14,4 @@
|
|||
- use string_to_double and string_to_long (from Table) everywhere
|
||||
- add const wherever should be
|
||||
- use static methods where posible
|
||||
- PERF in Row::Row(const Row &other), could be more efficient (memory and cpu)
|
||||
- use references where pointer cannot be nullptr
|
||||
|
|
|
|||
|
|
@ -2,11 +2,6 @@
|
|||
|
||||
namespace usql {
|
||||
|
||||
Exception::Exception(const std::string &msg) : std::runtime_error(msg) {
|
||||
cause = msg;
|
||||
}
|
||||
Exception::Exception(const std::string msg) : std::runtime_error(msg) {}
|
||||
|
||||
|
||||
const char *Exception::what() const noexcept { return cause.c_str(); }
|
||||
|
||||
}
|
||||
} // namespace
|
||||
|
|
|
|||
|
|
@ -7,13 +7,8 @@
|
|||
namespace usql {
|
||||
|
||||
class Exception : public std::runtime_error {
|
||||
private:
|
||||
std::string cause;
|
||||
|
||||
public:
|
||||
Exception(const std::string &msg);
|
||||
|
||||
const char *what() const noexcept;
|
||||
Exception(const std::string msg);
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace
|
||||
|
|
@ -13,8 +13,8 @@ namespace usql {
|
|||
|
||||
Lexer::Lexer() {
|
||||
k_words_regex =
|
||||
"[-+]?[0-9]+\\.[0-9]+|[-+]?[0-9][0-9_]+[0-9]|[0-9]+|[A-Za-z]+[A-Za-z0-9_#]*|[\\(\\)\\[\\]\\{\\}]|[-\\+\\*/"
|
||||
",;:\?]|!=|<>|==|>=|<=|~=|>|<|=|;|~|\\||or|and|\n|\r|\r\n|'([^']|'')*'|\".*?\"|%.*?\n";
|
||||
"[-+]?[0-9]+\\.[0-9]+|[-+]?[0-9]+|[A-Za-z]+[A-Za-z0-9_#]*|[\\(\\)\\[\\]\\{\\}]|[-\\+\\*/"
|
||||
",;:\?]|!=|<>|==|>=|<=|~=|>|<|=|;|~|\\||\n|\r|\r\n|'([^']|'')*'|\".*?\"|%.*?\n";
|
||||
k_int_regex = "[-+]?[0-9]+";
|
||||
k_int_underscored_regex = "[-+]?[0-9][0-9_]+[0-9]";
|
||||
k_double_regex = "[-+]?[0-9]+\\.[0-9]+";
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@ std::string date_to_string(const long datetime, const std::string format) {
|
|||
std::string result = {mbstr};
|
||||
return result;
|
||||
}
|
||||
// TODO exception here
|
||||
return "invalid argument";
|
||||
|
||||
throw std::runtime_error("date_to_string, invalid date string or format");
|
||||
}
|
||||
|
||||
time_t time_to_epoch ( const struct tm *ltm, int utcdiff ) {
|
||||
|
|
@ -71,8 +71,7 @@ long string_to_date(const std::string &datestr, const std::string &format) {
|
|||
return time_to_epoch(timeinfo, -1 * timeinfo->tm_gmtoff);
|
||||
}
|
||||
|
||||
// throw Exception("invalid date string or format");
|
||||
return -1;
|
||||
throw std::runtime_error("string_to_date, invalid date string or format");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
3
row.cpp
3
row.cpp
|
|
@ -172,13 +172,10 @@ int Row::print_get_column_size(const ColDefNode &col_def) {
|
|||
switch (col_def.type) {
|
||||
case ColumnType::varchar_type:
|
||||
return col_def.length;
|
||||
break;
|
||||
case ColumnType::date_type:
|
||||
return 19;
|
||||
break;
|
||||
case ColumnType::float_type:
|
||||
return 16;
|
||||
break;
|
||||
default:
|
||||
return 10;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue