19 int current = start - 1;
25 sprintf(
expected,
"row %04d", current);
28 fprintf(stderr,
"Failed. Expected i to be %d, was %d\n", current, (
int)
testint);
32 fprintf(stdout,
"Failed. Expected s to be |%s|, was |%s|\n",
expected,
teststr);
41 main(
int argc,
char **argv)
44 const int rows_to_add = 50;
52 fprintf(stdout,
"Starting %s\n", argv[0]);
60 fprintf(stdout,
"About to logon\n");
68 fprintf(stdout,
"About to open\n");
75 #ifdef MICROSOFT_DBLIB
81 fprintf(stdout,
"creating table\n");
88 fprintf(stdout,
"insert\n");
89 for (
i = 1;
i < rows_to_add;
i++) {
97 fprintf(stdout,
"first select\n");
99 fprintf(stderr,
"%s:%d: dbcmd failed\n", __FILE__, __LINE__);
103 fprintf(stderr,
"%s:%d: dbsqlexec failed\n", __FILE__, __LINE__);
109 fprintf(stdout,
"%s:%d: Was expecting a result set.", __FILE__, __LINE__);
124 fprintf(stdout,
"second select\n");
129 fprintf(stdout,
"%s:%d: Was expecting a result set. (rc=%d)\n", __FILE__, __LINE__, rc);
141 fprintf(stdout,
"%s %s\n", __FILE__, (
failed ?
"failed!" :
"OK"));
CS_RETCODE read_login_info(void)
int main(int argc, char **argv)
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)
static char teststr[1024]
static void get_results(DBPROCESS *dbproc, int start)
STATUS dbnextrow(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 DBSETLHOST(x, y)
Set the (client) host 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 dbuse(DBPROCESS *dbproc, const char *name)
Change current database.
RETCODE dbbind(DBPROCESS *dbproc, int column, int vartype, DBINT varlen, BYTE *varaddr)
Tie a host variable to a resultset column.
RETCODE dbsetopt(DBPROCESS *dbproc, int option, const char *char_param, int int_param)
Set db-lib or server option.
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
void dbexit()
Close server connections and free all related structures.
char * dbcolname(DBPROCESS *dbproc, int column)
Return name of a regular result column.
int dbnumcols(DBPROCESS *dbproc)
Return number of regular columns in a result set.
MHANDLEFUNC dbmsghandle(MHANDLEFUNC handler)
Set a message handler, for messages from the server.
int strncmp(const char *str1, const char *str2, size_t count)
static const char * expected[]