| 3255 |
mrmanese |
1 |
#include "R.h"
|
|
|
2 |
#include "Rdefines.h"
|
|
|
3 |
#include "Rinternals.h"
|
|
|
4 |
#include "sqlite3.h"
|
|
|
5 |
|
|
|
6 |
#ifndef __SQLITE_DATAFRAME__
|
|
|
7 |
#define __SQLITE_DATAFRAME__
|
|
|
8 |
|
|
|
9 |
#include "sqlite3.h"
|
|
|
10 |
|
|
|
11 |
#define WORKSPACE_COLUMNS 3
|
|
|
12 |
|
|
|
13 |
int _is_r_sym(char *sym);
|
|
|
14 |
int _file_exists(char *filename);
|
|
|
15 |
int _empty_callback(void *data, int ncols, char **row, char **cols);
|
|
|
16 |
char *_r2iname(char *internal_name, char *filename);
|
|
|
17 |
char *_fixname(char *rname);
|
|
|
18 |
char *_get_full_pathname2(char *relpath);
|
|
|
19 |
int _sqlite_error(int res);
|
|
|
20 |
SEXP _getListElement(SEXP list, char *varname);
|
|
|
21 |
int _expand_buf(int i, int size);
|
|
|
22 |
const char *_get_column_type(const char *class, int type);
|
|
|
23 |
int _add_sdf1(char *filename, char *internal_name);
|
|
|
24 |
SEXP _create_sdf_sexp(char *iname);
|
|
|
25 |
int _get_factor_levels1(const char *iname, const char *varname, SEXP var);
|
|
|
26 |
SEXP _shrink_vector(SEXP vec, int len);
|
|
|
27 |
|
|
|
28 |
#define _sqlite_exec(sql) sqlite3_exec(g_workspace, sql, _empty_callback, NULL, NULL)
|
|
|
29 |
|
|
|
30 |
/* R object accessors shortcuts */
|
|
|
31 |
#define CHAR_ELT(str, i) CHAR(STRING_ELT(str,i))
|
|
|
32 |
|
|
|
33 |
/* SDF object accessors shortcuts */
|
|
|
34 |
#define SDF_INAME(sdf) CHAR(STRING_ELT(_getListElement(sdf, "iname"),0))
|
|
|
35 |
#define SVEC_VARNAME(sdf) CHAR(STRING_ELT(_getListElement(sdf, "varname"),0))
|
|
|
36 |
|
|
|
37 |
/* # of sql buffers */
|
|
|
38 |
#define NBUFS 4
|
|
|
39 |
|
|
|
40 |
/* possible var types when stored in sqlite as integer */
|
|
|
41 |
#define VAR_INTEGER 0
|
|
|
42 |
#define VAR_FACTOR 1
|
|
|
43 |
#define VAR_ORDERED 2
|
|
|
44 |
|
|
|
45 |
|
|
|
46 |
#ifndef __SQLITE_WORKSPACE__
|
|
|
47 |
extern sqlite3 *g_workspace;
|
|
|
48 |
extern char *g_sql_buf[NBUFS];
|
|
|
49 |
extern int g_sql_buf_sz[NBUFS];
|
|
|
50 |
#endif
|
|
|
51 |
|
|
|
52 |
#endif
|