SpatiaLite  4.0.0-RC1
 All Data Structures Files Functions Variables Typedefs Macros Pages
gaiaaux.h
Go to the documentation of this file.
1 /*
2  gaiaaux.h -- Gaia common utility functions
3 
4  version 4.0, 2012 August 6
5 
6  Author: Sandro Furieri a.furieri@lqt.it
7 
8  ------------------------------------------------------------------------------
9 
10  Version: MPL 1.1/GPL 2.0/LGPL 2.1
11 
12  The contents of this file are subject to the Mozilla Public License Version
13  1.1 (the "License"); you may not use this file except in compliance with
14  the License. You may obtain a copy of the License at
15  http://www.mozilla.org/MPL/
16 
17 Software distributed under the License is distributed on an "AS IS" basis,
18 WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
19 for the specific language governing rights and limitations under the
20 License.
21 
22 The Original Code is the SpatiaLite library
23 
24 The Initial Developer of the Original Code is Alessandro Furieri
25 
26 Portions created by the Initial Developer are Copyright (C) 2008-2012
27 the Initial Developer. All Rights Reserved.
28 
29 Contributor(s):
30 
31 Alternatively, the contents of this file may be used under the terms of
32 either the GNU General Public License Version 2 or later (the "GPL"), or
33 the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
34 in which case the provisions of the GPL or the LGPL are applicable instead
35 of those above. If you wish to allow use of your version of this file only
36 under the terms of either the GPL or the LGPL, and not to allow others to
37 use your version of this file under the terms of the MPL, indicate your
38 decision by deleting the provisions above and replace them with the notice
39 and other provisions required by the GPL or the LGPL. If you do not delete
40 the provisions above, a recipient may use your version of this file under
41 the terms of any one of the MPL, the GPL or the LGPL.
42 
43 */
44 
50 #ifndef DOXYGEN_SHOULD_SKIP_THIS
51 #ifdef DLL_EXPORT
52 #define GAIAAUX_DECLARE __declspec(dllexport)
53 #else
54 #define GAIAAUX_DECLARE extern
55 #endif
56 #endif
57 
58 #ifndef _GAIAAUX_H
59 #ifndef DOXYGEN_SHOULD_SKIP_THIS
60 #define _GAIAAUX_H
61 #endif
62 
63 #ifdef __cplusplus
64 extern "C"
65 {
66 #endif
67 
68 /* constants */
70 #define GAIA_SQL_SINGLE_QUOTE 1001
71 
72 #define GAIA_SQL_DOUBLE_QUOTE 1002
73 
74 /* function prototypes */
75 
81  GAIAAUX_DECLARE const char *gaiaGetLocaleCharset (void);
82 
95  GAIAAUX_DECLARE int gaiaConvertCharset (char **buf, const char *fromCs,
96  const char *toCs);
97 
110  GAIAAUX_DECLARE void *gaiaCreateUTF8Converter (const char *fromCS);
111 
120  GAIAAUX_DECLARE void gaiaFreeUTF8Converter (void *cvtCS);
121 
140  GAIAAUX_DECLARE char *gaiaConvertToUTF8 (void *cvtCS, const char *buf,
141  int len, int *err);
142 
152  GAIAAUX_DECLARE int gaiaIsReservedSqliteName (const char *name);
153 
163  GAIAAUX_DECLARE int gaiaIsReservedSqlName (const char *name);
164 
174  GAIAAUX_DECLARE int gaiaIllegalSqlName (const char *name);
175 
190  GAIAAUX_DECLARE char *gaiaSingleQuotedSql (const char *value);
191 
206  GAIAAUX_DECLARE char *gaiaDoubleQuotedSql (const char *value);
207 
223  GAIAAUX_DECLARE char *gaiaQuotedSql (const char *value, int quote);
224 
225 /*
226 / DEPRECATED FUNCTION: gaiaCleanSqlString()
227 / this function must not be used for any new project
228 / it's still maintained for backward compatibility,
229 / but will be probably removed in future versions
230 */
231 
244  GAIAAUX_DECLARE void gaiaCleanSqlString (char *value);
245 
261  GAIAAUX_DECLARE void gaiaInsertIntoSqlLog(sqlite3 *sqlite, const char *user_agent, const char *utf8Sql, sqlite3_int64 *sqllog_pk);
262 
278  GAIAAUX_DECLARE void gaiaUpdateSqlLog(sqlite3 *sqlite, sqlite3_int64 sqllog_pk, int success, const char *errMsg);
279 
280 #ifdef __cplusplus
281 }
282 #endif
283 
284 #endif /* _GAIAAUX_H */