1 /***************************************************************************
2              sqlite_vlayer_module.h : SQLite module for QGIS virtual layers
3 begin                : Nov 2015
4 copyright            : (C) 2015 Hugo Mercier, Oslandia
5 email                : hugo dot mercier at oslandia dot com
6  ***************************************************************************/
7 
8 /***************************************************************************
9  *                                                                         *
10  *   This program is free software; you can redistribute it and/or modify  *
11  *   it under the terms of the GNU General Public License as published by  *
12  *   the Free Software Foundation; either version 2 of the License, or     *
13  *   (at your option) any later version.                                   *
14  *                                                                         *
15  ***************************************************************************/
16 
17 #ifndef QGSVIRTUAL_SQLITE_LAYER_MODULE_H
18 #define QGSVIRTUAL_SQLITE_LAYER_MODULE_H
19 
20 #ifdef __cplusplus
21 extern "C"
22 {
23 #endif
24 int vtableCreate( sqlite3 *sql, void *aux, int argc, const char *const *argv, sqlite3_vtab **out_vtab, char **out_err );
25 int vtableConnect( sqlite3 *sql, void *aux, int argc, const char *const *argv, sqlite3_vtab **out_vtab, char **out_err );
26 int vtableRename( sqlite3_vtab *vtab, const char *new_name );
27 int vtableBestIndex( sqlite3_vtab *vtab, sqlite3_index_info * );
28 int vtableDisconnect( sqlite3_vtab *vtab );
29 int vtableDestroy( sqlite3_vtab *vtab );
30 
31 int vtableOpen( sqlite3_vtab *vtab, sqlite3_vtab_cursor **out_cursor );
32 int vtableClose( sqlite3_vtab_cursor * );
33 int vtableFilter( sqlite3_vtab_cursor *cursor, int idxNum, const char *idxStr, int argc, sqlite3_value **argv );
34 
35 int vtableNext( sqlite3_vtab_cursor *cursor );
36 int vtableEof( sqlite3_vtab_cursor *cursor );
37 int vtableColumn( sqlite3_vtab_cursor *cursor, sqlite3_context *, int );
38 int vtableRowId( sqlite3_vtab_cursor *cursor, sqlite3_int64 *out_rowid );
39 
40 int qgsvlayerModuleInit( sqlite3 *db,
41                          char **pzErrMsg,
42                          void *unused /*const sqlite3_api_routines *pApi*/ );
43 
44 #ifdef __cplusplus
45 }
46 
47 #include "qgsgeometry.h"
48 
49 /**
50  * Init the SQLite file with proper metadata tables
51  */
52 void initVirtualLayerMetadata( sqlite3 *db );
53 
54 #endif
55 
56 #define VIRTUAL_LAYER_VERSION 1
57 
58 #endif
59