add paper
This commit is contained in:
@@ -281,15 +281,15 @@ inline const char* str(const bool& v) {
|
||||
return v ? "true" : "false";
|
||||
}
|
||||
|
||||
class A{
|
||||
class A {
|
||||
public:
|
||||
std::chrono::high_resolution_clock::time_point tp;
|
||||
A(){
|
||||
tp = std::chrono::high_resolution_clock::now();
|
||||
printf("A %llx created.\n", tp.time_since_epoch().count());
|
||||
printf("A %llu created.\n", tp.time_since_epoch().count());
|
||||
}
|
||||
~A() {
|
||||
printf("A %llx died after %lldns.\n", tp.time_since_epoch().count(),
|
||||
printf("A %llu died after %lldns.\n", tp.time_since_epoch().count(),
|
||||
(std::chrono::high_resolution_clock::now() - tp).count());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -6,17 +6,17 @@
|
||||
struct Context;
|
||||
|
||||
struct Server{
|
||||
MYSQL *server = 0;
|
||||
Context *cxt = 0;
|
||||
bool status = 0;
|
||||
MYSQL *server = nullptr;
|
||||
Context *cxt = nullptr;
|
||||
bool status = false;
|
||||
bool has_error = false;
|
||||
char* query = 0;
|
||||
char* query = nullptr;
|
||||
int type = 0;
|
||||
|
||||
void connect(Context* cxt, const char* host = "bill.local",
|
||||
const char* user = "root", const char* passwd = "0508",
|
||||
const char* db_name = "db", const unsigned int port = 3306,
|
||||
const char* unix_socket = 0, const unsigned long client_flag = 0
|
||||
const char* unix_socket = nullptr, const unsigned long client_flag = 0
|
||||
);
|
||||
void exec(const char* q);
|
||||
void close();
|
||||
|
||||
+11
-5
@@ -18,8 +18,12 @@
|
||||
#include <atomic>
|
||||
#endif // _WIN32
|
||||
|
||||
#undef ERROR
|
||||
#undef static_assert
|
||||
#ifdef ERROR
|
||||
#undef ERROR
|
||||
#endif
|
||||
#ifdef static_assert
|
||||
#undef static_assert
|
||||
#endif
|
||||
|
||||
constexpr const char* monetdbe_type_str[] = {
|
||||
"monetdbe_bool", "monetdbe_int8_t", "monetdbe_int16_t", "monetdbe_int32_t", "monetdbe_int64_t",
|
||||
@@ -86,7 +90,7 @@ void Server::connect(Context *cxt){
|
||||
char c[50];
|
||||
std::cin.getline(c, 49);
|
||||
for(int i = 0; i < 50; ++i) {
|
||||
if (!c[i] || c[i] == 'y' || c[i] == 'Y'){
|
||||
if (!c[i] || c[i] == 'y' || c[i] == 'Y') {
|
||||
monetdbe_close(*server);
|
||||
free(*server);
|
||||
this->server = nullptr;
|
||||
@@ -120,7 +124,7 @@ void Server::exec(const char* q){
|
||||
auto _res = static_cast<monetdbe_result*>(this->res);
|
||||
monetdbe_cnt _cnt = 0;
|
||||
auto qresult = monetdbe_query(*server, const_cast<char*>(q), &_res, &_cnt);
|
||||
if (_res != 0){
|
||||
if (_res != nullptr){
|
||||
this->cnt = _res->nrows;
|
||||
this->res = _res;
|
||||
}
|
||||
@@ -162,6 +166,8 @@ void Server::print_results(const char* sep, const char* end){
|
||||
col_data[i] = static_cast<char *>(cols[i]->data);
|
||||
szs [i] = monetdbe_type_szs[cols[i]->type];
|
||||
header_string = header_string + cols[i]->name + sep + '|' + sep;
|
||||
if (err_msg) [[unlikely]]
|
||||
puts(err_msg);
|
||||
}
|
||||
if (const size_t l_sep = strlen(sep) + 1; header_string.size() >= l_sep)
|
||||
header_string.resize(header_string.size() - l_sep);
|
||||
@@ -183,7 +189,7 @@ void Server::print_results(const char* sep, const char* end){
|
||||
void Server::close(){
|
||||
if(this->server){
|
||||
auto server = static_cast<monetdbe_database*>(this->server);
|
||||
monetdbe_close(*(server));
|
||||
monetdbe_close(*server);
|
||||
free(server);
|
||||
this->server = nullptr;
|
||||
}
|
||||
|
||||
@@ -4,18 +4,18 @@
|
||||
struct Context;
|
||||
|
||||
struct Server{
|
||||
void *server = 0;
|
||||
Context *cxt = 0;
|
||||
bool status = 0;
|
||||
char* query = 0;
|
||||
void *server = nullptr;
|
||||
Context *cxt = nullptr;
|
||||
bool status = false;
|
||||
char* query = nullptr;
|
||||
int type = 1;
|
||||
|
||||
void* res = 0;
|
||||
void* ret_col = 0;
|
||||
void* res = nullptr;
|
||||
void* ret_col = nullptr;
|
||||
long long cnt = 0;
|
||||
char* last_error = 0;
|
||||
char* last_error = nullptr;
|
||||
|
||||
Server(Context* cxt = nullptr);
|
||||
explicit Server(Context* cxt = nullptr);
|
||||
void connect(Context* cxt);
|
||||
void exec(const char* q);
|
||||
void *getCol(int col_idx);
|
||||
|
||||
@@ -77,7 +77,7 @@ monetdbe_get_size(monetdbe_database dbhdl, const char *table_name)
|
||||
}
|
||||
|
||||
void*
|
||||
monetdbe_get_col(monetdbe_database dbhdl, const char *table_name, uint32_t col_id) {
|
||||
monetdbe_get_col(monetdbe_database dbhdl, const char *table_name, uint32_t col_id) {
|
||||
monetdbe_database_internal* hdl = (monetdbe_database_internal*)dbhdl;
|
||||
backend* be = ((backend *)(((monetdbe_database_internal*)dbhdl)->c->sqlcontext));
|
||||
mvc *m = be->mvc;
|
||||
|
||||
@@ -6,7 +6,7 @@ template <class Comparator, typename T = uint32_t>
|
||||
class priority_vector : public vector_type<T> {
|
||||
const Comparator comp;
|
||||
public:
|
||||
priority_vector(Comparator comp = std::less<T>{}) :
|
||||
explicit priority_vector(Comparator comp = std::less<T>{}) :
|
||||
comp(comp), vector_type<T>(0) {}
|
||||
void emplace_back(T val) {
|
||||
vector_type<T>::emplace_back(val);
|
||||
|
||||
Reference in New Issue
Block a user