Source
void zbx_dbconn_large_query_prepare_str(zbx_db_large_query_t *query, zbx_dbconn_t *db, char **sql, size_t *sql_alloc,
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** This program 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 Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
struct zbx_db_result
{
MYSQL_RES *result;
PGresult *pg_result;
int row_num;
int fld_num;
int cursor;
zbx_db_row_t values;
int curow;
char **data;
int nrow;
int ncolumn;
zbx_db_row_t values;
};
static const zbx_db_config_t *db_config = NULL;
static ZBX_THREAD_LOCAL char ZBX_PG_ESCAPE_BACKSLASH = 1;
static zbx_mutex_t db_sqlite_access = ZBX_MUTEX_NULL;
static int dbconn_execute(zbx_dbconn_t *db, const char *fmt, ...);
static zbx_db_result_t dbconn_select(zbx_dbconn_t *db, const char *fmt, ...);
static int dbconn_open(zbx_dbconn_t *db);
static void dbconn_errlog(zbx_dbconn_t *db, zbx_err_codes_t zbx_errno, int db_errno, const char *db_error,
const char *context);