stumpless 2.2.0
载入中...
搜索中...
未找到
sqlite3.h
浏览该文件的文档.
1/* SPDX-License-Identifier: Apache-2.0 */
2
3/*
4 * Copyright 2023 Joel E. Anderson
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
38#ifndef __STUMPLESS_TARGET_SQLITE3_H
39#define __STUMPLESS_TARGET_SQLITE3_H
40
41#include <stdbool.h>
42#include <stddef.h>
43#include <stumpless/config.h>
44#include <stumpless/entry.h>
45#include <stumpless/target.h>
46
52#define STUMPLESS_DEFAULT_SQLITE3_INSERT_SQL \
53"INSERT INTO " STUMPLESS_DEFAULT_SQLITE3_TABLE_NAME_STRING " " \
54"( prival, version, timestamp, hostname, app_name, procid, msgid," \
55" structured_data, message ) " \
56"VALUES ( $prival, 1, $timestamp, $hostname, $app_name, $procid, $msgid, " \
57 "$structured_data, $message )"
58
59#ifdef __cplusplus
60extern "C" {
61#endif
62
70typedef
71void *
72( *stumpless_sqlite3_prepare_func_t )( const struct stumpless_entry *entry,
73 void *data,
74 size_t *count );
75
104bool
106
129void
131
174struct stumpless_target *
176
205void *
207
234const char *
236
268 void **data );
269
297struct stumpless_target *
299
333struct stumpless_target *
335
364struct stumpless_target *
366 int flags,
367 const char *vfs );
368
397struct stumpless_target *
399 const char *sql );
400
449struct stumpless_target *
452 void *data );
453
487void *
489 void *data,
490 size_t *count );
491
492#ifdef __cplusplus
493} /* extern "C" */
494#endif
495
496#endif /* __STUMPLESS_TARGET_SQLITE3_H */
#define STUMPLESS_PUBLIC_FUNCTION
Marks functions that are provided for use by the library.
定义 config.h:31
Types and functions for creating and modifying entries.
void *(* stumpless_sqlite3_prepare_func_t)(const struct stumpless_entry *entry, void *data, size_t *count)
A function for generating SQLite3 prepared statements for a given entry.
定义 sqlite3.h:72
struct stumpless_target * stumpless_open_sqlite3_target_from_db(void *db)
Opens a SQLite3 target with an already-open database handle.
struct stumpless_target * stumpless_create_default_sqlite3_table(struct stumpless_target *target)
Creates a table in the target's database for use with the default SQLite3 insertion behavior.
bool stumpless_close_sqlite3_target_and_db(const struct stumpless_target *target)
Closes a SQLite3 target and its database handle.
void * stumpless_get_sqlite3_db(const struct stumpless_target *target)
Gets the SQLite3 database handle used by the target.
struct stumpless_target * stumpless_set_sqlite3_insert_sql(struct stumpless_target *target, const char *sql)
Sets the SQL statement used to insert entries into the database.
stumpless_sqlite3_prepare_func_t stumpless_get_sqlite3_prepare(const struct stumpless_target *target, void **data)
Gets the preparation function and data pointer used to prepare statements for insertion into the data...
struct stumpless_target * stumpless_set_sqlite3_prepare(struct stumpless_target *target, stumpless_sqlite3_prepare_func_t preparer, void *data)
Set the function used to prepare statements for entries to this target.
struct stumpless_target * stumpless_open_sqlite3_target_with_options(const char *name, int flags, const char *vfs)
Opens a SQLite3 target with the provided options.
struct stumpless_target * stumpless_open_sqlite3_target(const char *name)
Opens a SQLite3 target.
void stumpless_close_sqlite3_target_only(const struct stumpless_target *target)
Closes a SQLite3 target, but does not touch the database handle.
void * stumpless_sqlite3_prepare(const struct stumpless_entry *entry, void *data, size_t *count)
The default prepare function used for SQLite3 targets.
const char * stumpless_get_sqlite3_insert_sql(const struct stumpless_target *target)
Gets the SQL statement used to insert entries into the database.
A log entry.
定义 entry.h:60
A target that log entries can be sent to.
定义 target.h:140
char * name
The name of this target.
定义 target.h:157
General types and functions for working with all targets.