-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathswhdb.h
73 lines (60 loc) · 1.97 KB
/
swhdb.h
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
/*
Swephelp
Copyright 2007-2020 Stanislas Marquis <[email protected]>
Swephelp 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 of
the License, or (at your option) any later version.
Swephelp 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 Swephelp. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SWHDB_H
#define SWHDB_H
#ifdef __cplusplus
extern "C"
{
#endif
#define SWH_DB_VERSION_INT 20210822
#define SWH_DB_VERSION_STR "20210822"
/** @brief Connect to astro database
*
* The environment variable SWH_DATA_PATH is checked for a valid string,
* and will override the path argument given.
*
* @param path Path to database file, can be NULL if set in environment
* @param check Check for correct database version (bool)
* @param err Buffer for error messages
* @return 0 if ok, or -1 if database needs upgrading, or >0 on error
*/
int swh_db_connect(
const char* path,
int check,
char err[512]);
/** @brief Close connection to astro database
*
* @return 0 if ok, or 1 on error
*/
int swh_db_close(void);
/** @brief Execute SQL statement on astro database
*
* @return 0 (SQLITE_OK), or -1 if no connection, or an sqlite3 error (>0)
*/
int swh_db_exec(
const char* sql,
int (*callback)(void* arg, int argc, char** argv, char** cols),
void* arg,
char err[512]);
/** @brief Check astro database version
*
* @return 0 if ok, -1 if db is not version expected, >0 on error
*/
int swh_db_check_version(char err[512]);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* SWHDB_H */
/* vi: set fenc=utf-8 ff=unix et sw=4 ts=4 : */