|
|
|
@ -1,3 +1,5 @@
|
|
|
|
|
// Non-standard Extensions for MonetDBe, may break concurrency control!
|
|
|
|
|
|
|
|
|
|
#include "monetdbe.h"
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
#include "mal_client.h"
|
|
|
|
@ -61,33 +63,28 @@ typedef struct {
|
|
|
|
|
str mid;
|
|
|
|
|
} monetdbe_database_internal;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
size_t
|
|
|
|
|
monetdbe_get_size(monetdbe_database dbhdl, const char* schema_name, const char *table_name)
|
|
|
|
|
monetdbe_get_size(monetdbe_database dbhdl, const char *table_name)
|
|
|
|
|
{
|
|
|
|
|
monetdbe_database_internal* hdl = (monetdbe_database_internal*)dbhdl;
|
|
|
|
|
backend* be = ((backend *)(((monetdbe_database_internal*)dbhdl)->c->sqlcontext));
|
|
|
|
|
mvc *m = be->mvc;
|
|
|
|
|
mvc_trans(m);
|
|
|
|
|
sql_table *t = find_table_or_view_on_scope(m, NULL, schema_name, table_name, "CATALOG", false);
|
|
|
|
|
sql_table *t = find_table_or_view_on_scope(m, NULL, "sys", table_name, "CATALOG", false);
|
|
|
|
|
sql_column *col = ol_first_node(t->columns)->data;
|
|
|
|
|
sqlstore* store = m->store;
|
|
|
|
|
size_t sz = store->storage_api.count_col(m->session->tr, col, QUICK);
|
|
|
|
|
mvc_cancel_session(m);
|
|
|
|
|
return sz;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void*
|
|
|
|
|
monetdbe_get_col(monetdbe_database dbhdl, const char* schema_name, 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;
|
|
|
|
|
mvc_trans(m);
|
|
|
|
|
sql_table *t = find_table_or_view_on_scope(m, NULL, schema_name, table_name, "CATALOG", false);
|
|
|
|
|
sql_table *t = find_table_or_view_on_scope(m, NULL, "sys", table_name, "CATALOG", false);
|
|
|
|
|
sql_column *col = ol_fetch(t->columns, col_id);
|
|
|
|
|
sqlstore* store = m->store;
|
|
|
|
|
BAT *b = store->storage_api.bind_col(m->session->tr, col, RDONLY);
|
|
|
|
|
BAT *b = store->storage_api.bind_col(m->session->tr, col, QUICK);
|
|
|
|
|
BATiter iter = bat_iterator(b);
|
|
|
|
|
mvc_cancel_session(m);
|
|
|
|
|
return iter.base;
|
|
|
|
|
}
|
|
|
|
|