2001-04-12 07:53:50 +08:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <glib.h>
|
|
|
|
#include <mdbtools.h>
|
|
|
|
|
2002-03-27 21:00:00 +08:00
|
|
|
#ifndef _mdbsql_h_
|
|
|
|
#define _mdbsql_h_
|
|
|
|
|
2001-04-12 07:53:50 +08:00
|
|
|
typedef struct {
|
|
|
|
MdbHandle *mdb;
|
|
|
|
int all_columns;
|
|
|
|
int num_columns;
|
|
|
|
GPtrArray *columns;
|
|
|
|
int num_tables;
|
|
|
|
GPtrArray *tables;
|
|
|
|
int num_sargs;
|
|
|
|
GPtrArray *sargs;
|
2001-07-24 19:00:00 +08:00
|
|
|
MdbTableDef *cur_table;
|
2003-01-21 00:04:24 +08:00
|
|
|
MdbSargNode *sarg_tree;
|
|
|
|
GList *sarg_stack;
|
2001-07-24 19:00:00 +08:00
|
|
|
/* FIX ME */
|
|
|
|
char *bound_values[256];
|
2001-04-12 07:53:50 +08:00
|
|
|
} MdbSQL;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
char *name;
|
|
|
|
int disp_size;
|
2001-05-16 08:21:17 +08:00
|
|
|
void *bind_addr; /* if !NULL then cp parameter to here */
|
|
|
|
int bind_type;
|
|
|
|
int *bind_len;
|
|
|
|
int bind_max;
|
2001-04-12 07:53:50 +08:00
|
|
|
} MdbSQLColumn;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
char *name;
|
|
|
|
char *alias;
|
|
|
|
} MdbSQLTable;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
char *col_name;
|
|
|
|
MdbSarg *sarg;
|
|
|
|
} MdbSQLSarg;
|
|
|
|
|
2001-05-16 08:21:17 +08:00
|
|
|
char *g_input_ptr;
|
|
|
|
|
2001-04-12 07:53:50 +08:00
|
|
|
#undef YY_INPUT
|
|
|
|
#define YY_INPUT(b, r, ms) (r = mdb_sql_yyinput(b, ms));
|
|
|
|
|
2003-04-30 01:55:09 +08:00
|
|
|
extern MdbSQL *mdb_sql_init();
|
|
|
|
extern MdbSQLSarg *mdb_sql_alloc_sarg();
|
|
|
|
extern MdbSQLColumn *mdb_sql_alloc_column();
|
|
|
|
extern MdbSQLTable *mdb_sql_alloc_table();
|
|
|
|
extern MdbHandle *mdb_sql_open(MdbSQL *sql, char *db_name);
|
|
|
|
extern int mdb_sql_add_sarg(MdbSQL *sql, char *col_name, int op, char *constant);
|
|
|
|
extern void mdb_sql_all_columns(MdbSQL *sql);
|
|
|
|
extern int mdb_sql_add_column(MdbSQL *sql, char *column_name);
|
|
|
|
extern int mdb_sql_add_table(MdbSQL *sql, char *table_name);
|
|
|
|
extern void mdb_sql_dump(MdbSQL *sql);
|
|
|
|
extern void mdb_sql_exit(MdbSQL *sql);
|
|
|
|
extern void mdb_sql_reset(MdbSQL *sql);
|
|
|
|
extern void mdb_sql_listtables(MdbSQL *sql);
|
|
|
|
extern void mdb_sql_select(MdbSQL *sql);
|
|
|
|
extern void mdbsql_bind_all(MdbSQL *sql);
|
2002-03-27 21:00:00 +08:00
|
|
|
|
|
|
|
#endif
|