| Line 4... |
Line 4... |
| 4 |
#include "sqlite3.h"
|
4 |
#include "sqlite3.h"
|
| 5 |
|
5 |
|
| 6 |
#ifndef __SQLITE_DATAFRAME__
|
6 |
#ifndef __SQLITE_DATAFRAME__
|
| 7 |
#define __SQLITE_DATAFRAME__
|
7 |
#define __SQLITE_DATAFRAME__
|
| 8 |
|
8 |
|
| 9 |
#define WORKSPACE_COLUMNS 5
|
9 |
#define WORKSPACE_COLUMNS 6
|
| 10 |
#ifndef WIN32
|
10 |
#ifndef WIN32
|
| 11 |
#define MAX_ATTACHED 30 /* 31 including workspace.db */
|
11 |
#define MAX_ATTACHED 30 /* 31 including workspace.db */
|
| 12 |
#else
|
12 |
#else
|
| 13 |
#define MAX_ATTACHED 10 /* set to 10 until I have recompiled it to 30 */
|
13 |
#define MAX_ATTACHED 10 /* set to 10 until I have recompiled it to 30 */
|
| 14 |
#endif
|
14 |
#endif
|
| Line 17... |
Line 17... |
| 17 |
int _is_r_sym(char *sym);
|
17 |
int _is_r_sym(char *sym);
|
| 18 |
int _file_exists(char *filename);
|
18 |
int _file_exists(char *filename);
|
| 19 |
int _sdf_exists2(char *iname);
|
19 |
int _sdf_exists2(char *iname);
|
| 20 |
|
20 |
|
| 21 |
/* sdf utilities */
|
21 |
/* sdf utilities */
|
| 22 |
int USE_SDF1(const char *iname, int exists); /* call this before doing anything on an SDF */
|
22 |
int USE_SDF1(const char *iname, int exists, int protect); /* call this before doing anything on an SDF */
|
| - |
|
23 |
int UNUSE_SDF2(const char *iname); /* somewhat like UNPROTECT */
|
| 23 |
SEXP _create_sdf_sexp(const char *iname); /* create a SEXP for an SDF */
|
24 |
SEXP _create_sdf_sexp(const char *iname); /* create a SEXP for an SDF */
|
| 24 |
int _add_sdf1(char *filename, char *internal_name); /* add SDF to workspace */
|
25 |
int _add_sdf1(char *filename, char *internal_name); /* add SDF to workspace */
|
| 25 |
void _delete_sdf2(const char *iname); /* remove SDF from workspace */
|
26 |
void _delete_sdf2(const char *iname); /* remove SDF from workspace */
|
| 26 |
int _get_factor_levels1(const char *iname, const char *varname, SEXP var);
|
27 |
int _get_factor_levels1(const char *iname, const char *varname, SEXP var);
|
| 27 |
int _get_row_count2(const char *table, int quote);
|
28 |
int _get_row_count2(const char *table, int quote);
|
| 28 |
SEXP _get_rownames(const char *sdf_iname);
|
29 |
SEXP _get_rownames(const char *sdf_iname);
|
| 29 |
char *_get_full_pathname2(char *relpath); /* get full path given relpath, used in workspace mgmt */
|
30 |
char *_get_full_pathname2(char *relpath); /* get full path given relpath, used in workspace mgmt */
|
| - |
|
31 |
int _is_factor2(const char *iname, const char *factor_type, const char *colname);
|
| - |
|
32 |
SEXP _get_rownames2(const char *sdf_iname);
|
| 30 |
|
33 |
|
| 31 |
/* utilities for creating SDF's */
|
34 |
/* utilities for creating SDF's */
|
| 32 |
char *_create_sdf_skeleton1(SEXP name, int *o_namelen);
|
35 |
char *_create_sdf_skeleton1(SEXP name, int *o_namelen, int protect);
|
| 33 |
int _copy_factor_levels2(const char *factor_type, const char *iname_src,
|
36 |
int _copy_factor_levels2(const char *factor_type, const char *iname_src,
|
| 34 |
const char *colname_src, const char *iname_dst, const char *colname_dst);
|
37 |
const char *colname_src, const char *iname_dst, const char *colname_dst);
|
| 35 |
int _create_factor_table2(const char *iname, const char *factor_type,
|
38 |
int _create_factor_table2(const char *iname, const char *factor_type,
|
| 36 |
const char *colname);
|
39 |
const char *colname);
|
| - |
|
40 |
char *_create_svector1(SEXP name, const char *type, int * _namelen, int protect);
|
| 37 |
|
41 |
|
| 38 |
/* R utilities */
|
42 |
/* R utilities */
|
| 39 |
SEXP _getListElement(SEXP list, char *varname);
|
43 |
SEXP _getListElement(SEXP list, char *varname);
|
| 40 |
SEXP _shrink_vector(SEXP vec, int len); /* shrink vector size */
|
44 |
SEXP _shrink_vector(SEXP vec, int len); /* shrink vector size */
|
| 41 |
|
45 |
|
| Line 63... |
Line 67... |
| 63 |
|
67 |
|
| 64 |
/* register functions to sqlite */
|
68 |
/* register functions to sqlite */
|
| 65 |
void __register_vector_math();
|
69 |
void __register_vector_math();
|
| 66 |
|
70 |
|
| 67 |
#define _sqlite_exec(sql) sqlite3_exec(g_workspace, sql, _empty_callback, NULL, NULL)
|
71 |
#define _sqlite_exec(sql) sqlite3_exec(g_workspace, sql, _empty_callback, NULL, NULL)
|
| 68 |
#define _sqlite_error(sql) _sqlite_error_check((sql), __FILE__, __LINE__)
|
72 |
#define _sqlite_error(res) _sqlite_error_check((res), __FILE__, __LINE__)
|
| - |
|
73 |
|
| - |
|
74 |
#ifdef __SQLITE_DEBUG__
|
| - |
|
75 |
#define _sqlite_begin { _sqlite_error(_sqlite_exec("begin")); Rprintf("begin at " __FILE__ " line %d\n", __LINE__); }
|
| - |
|
76 |
#define _sqlite_commit { _sqlite_error(_sqlite_exec("commit")); Rprintf("commit at " __FILE__ " line %d\n", __LINE__); }
|
| - |
|
77 |
#else
|
| - |
|
78 |
#define _sqlite_begin _sqlite_error(_sqlite_exec("begin"))
|
| - |
|
79 |
#define _sqlite_commit _sqlite_error(_sqlite_exec("commit"))
|
| - |
|
80 |
#endif
|
| - |
|
81 |
|
| 69 |
#ifndef SET_ROWNAMES
|
82 |
#ifndef SET_ROWNAMES
|
| 70 |
#define SET_ROWNAMES(x,n) setAttrib(x, R_RowNamesSymbol, n)
|
83 |
#define SET_ROWNAMES(x,n) setAttrib(x, R_RowNamesSymbol, n)
|
| 71 |
#endif
|
84 |
#endif
|
| 72 |
|
85 |
|
| 73 |
/* override R's, which does a GetRowNames which is different I believe */
|
86 |
/* override R's, which does a GetRowNames which is different I believe */
|