/*****************************************************************************\
* Copyright (c) 2002 Pelle Johansson. *
* All rights reserved. *
* *
* This file is part of the moftpd package. Use and distribution of *
* this software is governed by the terms in the file LICENCE, which *
* should have come with this package. *
\*****************************************************************************/
/* $moftpd: sql.h 1251 2005-03-06 22:24:29Z morth $ */
#ifndef _SQL_H
#define _SQL_H
#ifdef USE_SQL
enum
{
sqlINVALID, sqlMYSQL
};
typedef struct sql
{
int type;
union
{
#ifdef HAVE_MYSQL
struct
{
MYSQL *h;
MYSQL_RES *r;
MYSQL_ROW row;
int ccol, crow;
} mysql;
#endif
} u;
} sql_t;
typedef struct sql_arg
{
char *str;
char ch;
} sql_arg_t;
int sql_connect (sql_t *sql, const char *host, const char *user, const char *db,
const char *pass, const char *cert, const char *key);
void sql_disconnect (sql_t *sql);
char *sql_quote (const char *str);
int sql_query (sql_t *sql, const char *query, int nargs, const sql_arg_t *args);
const char *sql_fetch_cell (sql_t *sql, int row, int col);
void sql_free_result (sql_t *sql);
const char *sql_error (sql_t *sql);
#endif /*USE_SQL*/
#endif /*_SQL_H*/
syntax highlighted by Code2HTML, v. 0.9.1