File: gb.db.proto.h

package info (click to toggle)
gambas3 3.20.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 76,984 kB
  • sloc: ansic: 197,178; cpp: 124,076; sh: 18,999; javascript: 7,761; sql: 5,399; makefile: 2,354; perl: 1,397; xml: 490; python: 335
file content (148 lines) | stat: -rw-r--r-- 5,537 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/***************************************************************************

  gb.db.proto.h

  (c) 2000-2017 BenoƮt Minisini <benoit.minisini@gambas-basic.org>

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2, or (at your option)
  any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  MA 02110-1301, USA.

***************************************************************************/

#ifndef __GB_DB_PROTO_H
#define __GB_DB_PROTO_H

#include "gb.db.h"

static const char *get_quote(void);
static int open_database(DB_DESC *desc,  DB_DATABASE *db);
static void close_database(DB_DATABASE *db);
static GB_ARRAY get_collations(DB_DATABASE *db);
static int64_t get_last_insert_id(DB_DATABASE *db);
static int format_value(GB_VALUE *arg, DB_FORMAT_CALLBACK add);
static void format_blob(DB_BLOB *blob, DB_FORMAT_CALLBACK add);
static int exec_query(DB_DATABASE *db, const char *query, DB_RESULT *result, const char *err);
static void query_init(DB_RESULT result, DB_INFO *info, int *count);
static void query_release(DB_RESULT result, DB_INFO *info, bool invalid);
static int query_fill(DB_DATABASE *db, DB_RESULT result, int pos, GB_VARIANT_VALUE *buffer, int next);
static void blob_read(DB_RESULT result, int pos, int field, DB_BLOB *blob);
static char *field_name(DB_RESULT result, int field);
static int field_index(DB_RESULT result, const char *name, DB_DATABASE *db);
static GB_TYPE field_type(DB_RESULT result, int field);
static int field_length(DB_RESULT result, int field);
static int begin_transaction(DB_DATABASE *db);
static int commit_transaction(DB_DATABASE *db);
static int rollback_transaction(DB_DATABASE *db);
static int field_info(DB_DATABASE *db, const char *table, const char *field, DB_FIELD *info);
static int table_init(DB_DATABASE *db, const char *table, DB_INFO *info);
static int table_index(DB_DATABASE *db, const char *table, DB_INFO *info);
static void table_release(DB_DATABASE *db, DB_INFO *info);
static int table_exist(DB_DATABASE *db, const char *table);
static int table_list(DB_DATABASE *db, char ***tables);
static int table_primary_key(DB_DATABASE *db, const char *table, char ***primary);
static int table_is_system(DB_DATABASE *db, const char *table);
static char *table_type(DB_DATABASE *db, const char *table, const char *type);
static int table_delete(DB_DATABASE *db, const char *table);
static int table_create(DB_DATABASE *db, const char *table, DB_FIELD *fields, char **primary, const char *type);
static int field_exist(DB_DATABASE *db, const char *table, const char *field);
static int field_list(DB_DATABASE *db, const char *table, char ***fields);
static int field_info(DB_DATABASE *db, const char *table, const char *field, DB_FIELD *info);
static int index_exist(DB_DATABASE *db, const char *table, const char *index);
static int index_list(DB_DATABASE *db, const char *table, char ***indexes);
static int index_info(DB_DATABASE *db, const char *table, const char *index, DB_INDEX *info);
static int index_delete(DB_DATABASE *db, const char *table, const char *index);
static int index_create(DB_DATABASE *db, const char *table, const char *index, DB_INDEX *info);
static int database_exist(DB_DATABASE *db, const char *name);
static int database_list(DB_DATABASE *db, char ***databases);
static int database_is_system(DB_DATABASE *db, const char *name);
static int database_delete(DB_DATABASE *db, const char *name);
static int database_create(DB_DATABASE *db, const char *name);
static int user_exist(DB_DATABASE *db, const char *name);
static int user_list(DB_DATABASE *db, char ***users);
static int user_info(DB_DATABASE *db, const char *name, DB_USER *info );
static int user_delete(DB_DATABASE *db, const char *name);
static int user_create(DB_DATABASE *db, const char *name, DB_USER *info);
static int user_set_password(DB_DATABASE *db, const char *name, const char *password);

#define DECLARE_DRIVER(_driver, _name) \
static DB_DRIVER _driver = \
{ \
  _name, \
  open_database, \
  close_database, \
  format_value, \
  format_blob, \
  exec_query, \
  begin_transaction, \
  commit_transaction, \
  rollback_transaction, \
  get_collations, \
  get_quote, \
  get_last_insert_id, \
  { \
    query_init, \
    query_fill, \
    blob_read, \
    query_release, \
    { \
      field_type, \
      field_name, \
      field_index, \
      field_length, \
    }, \
  }, \
  { \
    field_exist, \
    field_list, \
    field_info, \
  }, \
  { \
    table_init, \
    table_index, \
    table_release, \
    table_exist, \
    table_list, \
    table_primary_key, \
    table_is_system, \
    table_type, \
    table_delete, \
    table_create, \
  }, \
  { \
    index_exist, \
    index_list, \
    index_info, \
    index_delete, \
    index_create, \
  }, \
  { \
    database_exist, \
    database_list, \
    database_is_system, \
    database_delete, \
    database_create, \
  }, \
  { \
    user_exist, \
    user_list, \
    user_info, \
    user_delete, \
    user_create, \
    user_set_password \
  } \
};


#endif