This file is indexed.

/usr/lib/grass74/include/grass/dbmi.h is in grass-dev 7.4.0-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
/*!
  \file include/dbmi.h

  \brief Main header of \ref dbmilib

  (C) 1999-2009, 2011 by the GRASS Development Team
  
  This program is free software under the GNU General Public License
  (>=v2). Read the file COPYING that comes with GRASS for details.
*/

#ifndef GRASS_DBMI_H
#define GRASS_DBMI_H

#include <stdio.h>
#include <grass/gis.h>

#define DB_VERSION "0"

#ifdef HAVE_SQLITE
#define DB_DEFAULT_DRIVER "sqlite"
#else
#define DB_DEFAULT_DRIVER "dbf"
#endif

/* DB Prodedure Numbers */
#define DB_PROC_VERSION                 999

#define DB_PROC_CLOSE_DATABASE		101
#define DB_PROC_CREATE_DATABASE		102
#define DB_PROC_DELETE_DATABASE		103
#define DB_PROC_FIND_DATABASE		104
#define DB_PROC_LIST_DATABASES		105
#define DB_PROC_OPEN_DATABASE		106
#define DB_PROC_SHUTDOWN_DRIVER		107

#define DB_PROC_CLOSE_CURSOR		201
#define DB_PROC_DELETE			202
#define DB_PROC_FETCH			203
#define DB_PROC_INSERT			204
#define DB_PROC_OPEN_INSERT_CURSOR	205
#define DB_PROC_OPEN_SELECT_CURSOR	206
#define DB_PROC_OPEN_UPDATE_CURSOR	207
#define DB_PROC_UPDATE			208
#define DB_PROC_ROWS			209
#define DB_PROC_BIND_UPDATE		220
#define DB_PROC_BIND_INSERT		221

#define DB_PROC_EXECUTE_IMMEDIATE	301
#define DB_PROC_BEGIN_TRANSACTION	302
#define DB_PROC_COMMIT_TRANSACTION	303

#define DB_PROC_CREATE_TABLE		401
#define DB_PROC_DESCRIBE_TABLE		402
#define DB_PROC_DROP_TABLE		403
#define DB_PROC_LIST_TABLES		404
#define DB_PROC_ADD_COLUMN		405
#define DB_PROC_DROP_COLUMN		406
#define DB_PROC_GRANT_ON_TABLE		407

#define DB_PROC_CREATE_INDEX		701
#define DB_PROC_LIST_INDEXES		702
#define DB_PROC_DROP_INDEX		703

/* Unix file permissions */
#define DB_PERM_R	01
#define DB_PERM_W	02
#define DB_PERM_X	04

/* DB Error codes */
#define DB_OK		 0
#define DB_FAILED	 1
#define DB_NOPROC	 2
#define DB_MEMORY_ERR	-1
#define DB_PROTOCOL_ERR	-2
#define DB_EOF		-1

/* dbColumn.sqlDataType */
#define DB_SQL_TYPE_UNKNOWN          0

#define DB_SQL_TYPE_CHARACTER        1
#define DB_SQL_TYPE_SMALLINT         2
#define DB_SQL_TYPE_INTEGER          3
#define DB_SQL_TYPE_REAL             4
#define DB_SQL_TYPE_DOUBLE_PRECISION 6
#define DB_SQL_TYPE_DECIMAL          7
#define DB_SQL_TYPE_NUMERIC          8
#define DB_SQL_TYPE_DATE             9
#define DB_SQL_TYPE_TIME            10
#define DB_SQL_TYPE_TIMESTAMP       11
#define DB_SQL_TYPE_INTERVAL        12
#define DB_SQL_TYPE_TEXT            13	/* length not defined */

#define DB_SQL_TYPE_SERIAL          21

/* these are OR'ed (|) with the TIMESTAMP and INTERVAL type */
#define DB_YEAR              0x4000
#define DB_MONTH             0x2000
#define DB_DAY               0x1000
#define DB_HOUR              0x0800
#define DB_MINUTE            0x0400
#define DB_SECOND            0x0200
#define DB_FRACTION          0x0100
#define DB_DATETIME_MASK     0xFF00

/* dbColumn.CDataType */
#define DB_C_TYPE_STRING          1
#define DB_C_TYPE_INT             2
#define DB_C_TYPE_DOUBLE          3
#define DB_C_TYPE_DATETIME        4

/* fetch positions */
#define DB_CURRENT		1
#define DB_NEXT			2
#define DB_PREVIOUS		3
#define DB_FIRST		4
#define DB_LAST			5

/* cursor modes/types */
#define DB_READONLY		1
#define DB_INSERT		2
#define DB_UPDATE		3
#define DB_SEQUENTIAL		0
#define DB_SCROLL		1
#define DB_INSENSITIVE		4

/* privilege modes */
#define DB_GRANTED		1
#define DB_NOT_GRANTED		-1

/* Privileges */
#define DB_PRIV_SELECT       0x01

#define DB_GROUP             0x01
#define DB_PUBLIC            0x02

/* default value modes */
#define DB_DEFINED	1
#define DB_UNDEFINED	2

/* static buffer for SQL statements */
#define DB_SQL_MAX      4096

typedef void *dbAddress;
typedef int dbToken;

typedef struct _db_string
{
    char *string;
    int nalloc;
} dbString;

typedef struct _dbmscap
{
    char driverName[256];	/* symbolic name for the dbms system */
    char startup[256];		/* command to run the driver */
    char comment[256];		/* comment field             */
    struct _dbmscap *next;	/* linked list               */
} dbDbmscap;

typedef struct _db_dirent
{
    dbString name;		/* file/dir name             */
    int isdir;			/* bool: name is a directory */
    int perm;			/* permissions               */
} dbDirent;

typedef struct _db_driver
{
    dbDbmscap dbmscap;		/* dbmscap entry for this driver */
    FILE *send, *recv;		/* i/o to-from driver            */
    int pid;			/* process id of the driver      */
} dbDriver;

typedef struct _db_handle
{
    dbString dbName;		/* database name               */
    /* dbString dbPath; *//* directory containing dbName */
    dbString dbSchema;		/* database schema */
} dbHandle;

typedef struct _db_date_time
{
    char current;
    int year;
    int month;
    int day;
    int hour;
    int minute;
    double seconds;
} dbDateTime;

typedef struct _db_value
{
    char isNull;
    int i;
    double d;
    dbString s;
    dbDateTime t;
} dbValue;

typedef struct _db_column
{
    dbString columnName;
    dbString description;
    int sqlDataType;
    int hostDataType;
    dbValue value;
    int dataLen;
    int precision;
    int scale;
    char nullAllowed;
    char hasDefaultValue;
    char useDefaultValue;
    dbValue defaultValue;
    int select;
    int update;
} dbColumn;

typedef struct _db_table
{
    dbString tableName;
    dbString description;
    int numColumns;
    dbColumn *columns;
    int priv_insert;
    int priv_delete;
} dbTable;

typedef struct _db_cursor
{
    dbToken token;
    dbDriver *driver;
    dbTable *table;
    short *column_flags;
    int type;
    int mode;
} dbCursor;

typedef struct _db_index
{
    dbString indexName;
    dbString tableName;
    int numColumns;
    dbString *columnNames;
    char unique;
} dbIndex;

typedef struct _db_driver_state
{
    char *dbname;
    char *dbschema;
    int open;
    int ncursors;
    dbCursor **cursor_list;
} dbDriverState;

/* category value (integer) */
typedef struct
{
    int cat;			/* category */
    int val;			/* value */
} dbCatValI;

/* category value */
typedef struct
{
    int cat;			/* category */
    int isNull;
    union
    {
	int i;
	double d;
	/* s and t were added 22.8.2005, both are pointers,
	 * they so should not take more than 8 bytes.
	 * It would be better to add dbString, not pointer,
	 * But it could be > 8 bytes on some systems */
	dbString *s;
	dbDateTime *t;
    } val;
} dbCatVal;

/* category value array */
typedef struct
{
    int n_values;
    int alloc;
    int ctype;			/* C type of values stored in array DB_C_TYPE_* */
    dbCatVal *value;
} dbCatValArray;

/* parameters of connection */
typedef struct _db_connection
{
    char *driverName;
    char *hostName;
    char *databaseName;
    char *schemaName;
    char *port;
    char *user;
    char *password;
    char *keycol;		/* name of default key column */
    char *group;		/* default group to which select privilege is granted */
} dbConnection;

/* reclass rule */
typedef struct
{
    int count;			/* number of defined rules */
    int alloc;			/* size of allocated array */
    char *table;		/* table name */
    char *key;			/* key column name */
    int *cat;			/* array of new category numbers */
    char **where;		/* array of SQL WHERE conditions */
    char **label;		/* array of new category labels */
} dbRclsRule;

#include <grass/defs/dbmi.h>

#endif