mm_db.h revision cee0fb94c0d4227de0a00efc162fb2739844b641
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _MM_DB_H
#define _MM_DB_H
#include <limits.h>
#include <libpq-fe.h>
struct mm_db_cfg {
char *mm_db_host;
int mm_db_port;
char *mm_db_user;
char *mm_db_name;
char *mm_db_passwd;
int mm_db_bool_oid;
int mm_db_timestamp_oid;
};
struct mm_db {
int mm_db_rval; /* database return value */
int mm_db_oid; /* row oid, invalid if more than 1 */
int mm_db_count; /* number of rows changed */
int mm_db_txn_blk; /* transaction block flag */
int mm_db_fd; /* database socket file descriptor */
/* commands for this db's txn block */
int mm_db_has_list;
int mm_db_resending;
};
enum mm_db_rval {
MM_DB_OK = 0, /* operation successful */
MM_DB_DATA, /* data (tuples) rows */
MM_DB_ERROR, /* operation failed */
MM_DB_DROPPED /* database item dropped */
};
extern void mm_db_disconnect(mm_db_t *);
extern char *mm_db_sql_err_rsp(int, char *, char *, char *);
extern char *mm_db_escape_string(char *from);
#endif /* _MM_DB_H */