13 main(
int argc,
char **argv)
15 const int rows_to_add = 10;
23 fprintf(stdout,
"Starting %s\n", argv[0]);
31 fprintf(stdout,
"About to logon\n");
34 fprintf(stdout,
"after dblogin\n");
39 fprintf(stdout,
"About to open [%s]\n",
USER);
42 fprintf(stdout,
"After dbopen [%s]\n",
SERVER);
45 fprintf(stdout,
"About to dbuse [%s]\n",
DATABASE);
50 fprintf(stdout,
"After dbuse [%s]\n",
DATABASE);
52 fprintf(stdout,
"creating table\n");
59 fprintf(stdout,
"insert\n");
60 for (
i = 0;
i < rows_to_add;
i++) {
68 fprintf(stdout,
"select one resultset\n");
85 fprintf(stdout,
"Was expecting nresults == 1.\n");
91 fprintf(stdout,
"select two resultsets\n");
109 fprintf(stdout,
"nresults was %d; was expecting nresults = 2.\n", nresults);
116 fprintf(stdout,
"%s %s\n", __FILE__, (
failed ?
"failed!" :
"OK"));
CS_RETCODE read_login_info(void)
int syb_err_handler(DBPROCESS *dbproc, int severity, int dberr, int oserr, char *dberrstr, char *oserrstr)
RETCODE sql_cmd(DBPROCESS *dbproc)
int syb_msg_handler(DBPROCESS *dbproc, DBINT msgno, int msgstate, int severity, char *msgtext, char *srvname, char *procname, int line)
void set_malloc_options(void)
int main(int argc, char **argv)
static DBPROCESS * dbproc
#define DBSETLPWD(x, y)
Set the password in the login packet.
#define DBSETLAPP(x, y)
Set the (client) application name in the login packet.
#define DBSETLUSER(x, y)
Set the username in the login packet.
LOGINREC * dblogin(void)
Allocate a LOGINREC structure.
RETCODE dbresults(DBPROCESS *dbproc)
Set up query results.
RETCODE dbinit(void)
Initialize db-lib.
RETCODE dbcancel(DBPROCESS *dbproc)
Cancel the current command batch.
RETCODE dbuse(DBPROCESS *dbproc, const char *name)
Change current database.
RETCODE dbsqlexec(DBPROCESS *dbproc)
send the SQL command to the server and wait for an answer.
EHANDLEFUNC dberrhandle(EHANDLEFUNC handler)
Set an error handler, for messages from db-lib.
void dbloginfree(LOGINREC *login)
free the LOGINREC
RETCODE dbmorecmds(DBPROCESS *dbproc)
See if more commands are to be processed.
void dbexit()
Close server connections and free all related structures.
MHANDLEFUNC dbmsghandle(MHANDLEFUNC handler)
Set a message handler, for messages from the server.