mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 16:03:03 +01:00
Clean the examples.
When the build scripts are revised, it will be able to check the changes.
This commit is contained in:
parent
788f278f80
commit
1a17862ca2
@ -40,9 +40,7 @@ int pr_error (long *, char *);
|
||||
static char *create_tbl = "CREATE TABLE dbinfo (when_created DATE)";
|
||||
static char *insert_date = "INSERT INTO dbinfo VALUES ('NOW')";
|
||||
|
||||
int main (ARG(int, argc), ARG(char **, argv))
|
||||
ARGLIST(int argc)
|
||||
ARGLIST(char **argv)
|
||||
int main (int argc, char** argv)
|
||||
{
|
||||
isc_db_handle newdb = NULL; /* database handle */
|
||||
isc_tr_handle trans = NULL; /* transaction handle */
|
||||
@ -125,9 +123,7 @@ ARGLIST(char **argv)
|
||||
* Print the status, the SQLCODE, and exit.
|
||||
* Also, indicate which operation the error occured on.
|
||||
*/
|
||||
int pr_error (ARG(long *, status), ARG(char *, operation))
|
||||
ARGLIST(long * status)
|
||||
ARGLIST(char * operation)
|
||||
int pr_error (long* status, char* operation)
|
||||
{
|
||||
printf("[\n");
|
||||
printf("PROBLEM ON \"%s\".\n", operation);
|
||||
@ -140,3 +136,4 @@ ARGLIST(char * operation)
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -38,9 +38,7 @@ char *upd_str =
|
||||
"UPDATE proj_dept_budget SET quart_head_cnt = ? WHERE CURRENT OF S";
|
||||
|
||||
|
||||
int main (ARG(int, argc), ARG(char **, argv))
|
||||
ARGLIST(int argc)
|
||||
ARGLIST(char **argv)
|
||||
int main (int argc, char** argv)
|
||||
{
|
||||
long hcnt[4];
|
||||
ISC_QUAD array_id;
|
||||
@ -154,7 +152,7 @@ ARGLIST(char **argv)
|
||||
(ISC_ARRAY_DESC *) &desc,
|
||||
(void *) hcnt,
|
||||
(long *) &len))
|
||||
{ERREXIT (status, 1)};
|
||||
{ERREXIT (status, 1)}
|
||||
|
||||
dept_no [osqlda->sqlvar[0].sqllen] = '\0';
|
||||
printf("Department #: %s\n\n", dept_no);
|
||||
@ -172,7 +170,7 @@ ARGLIST(char **argv)
|
||||
(ISC_ARRAY_DESC *) &desc,
|
||||
(void *) hcnt,
|
||||
(long *) &len))
|
||||
{ERREXIT (status, 1)};
|
||||
{ERREXIT (status, 1)}
|
||||
|
||||
/* Update the array handle. */
|
||||
if (isc_dsql_execute(status, &trans, &ustmt, 1, isqlda))
|
||||
@ -210,3 +208,4 @@ ARGLIST(char **argv)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -37,9 +37,7 @@ int select_projects (isc_db_handle db, int emp_no);
|
||||
int add_emp_proj (isc_db_handle db, int emp_no, char * proj_id);
|
||||
int get_params (isc_db_handle db, int * emp_no, char * proj_id);
|
||||
|
||||
int main (ARG(int, argc), ARG(char **, argv))
|
||||
ARGLIST(int argc)
|
||||
ARGLIST(char **argv)
|
||||
int main (int argc, char** argv)
|
||||
{
|
||||
int emp_no;
|
||||
char proj_id[PROJLEN + 2];
|
||||
@ -97,9 +95,7 @@ ARGLIST(char **argv)
|
||||
* Select from a stored procedure.
|
||||
* Procedure 'get_emp_proj' gets employee's projects.
|
||||
*/
|
||||
int select_projects (ARG(isc_db_handle, db), ARG(int, emp_no))
|
||||
ARGLIST(void *db)
|
||||
ARGLIST(int emp_no)
|
||||
int select_projects (isc_db_handle db, int emp_no)
|
||||
{
|
||||
char proj_id[PROJLEN + 2];
|
||||
char selstr[BUFLEN];
|
||||
@ -171,10 +167,7 @@ ARGLIST(int emp_no)
|
||||
* Execute a stored procedure.
|
||||
* Procedure 'add_emp_proj' adds an employee to a project.
|
||||
*/
|
||||
int add_emp_proj (ARG(isc_db_handle, db), ARG(int, emp_no), ARG(char *, proj_id))
|
||||
ARGLIST(void *db)
|
||||
ARGLIST(int emp_no)
|
||||
ARGLIST(char *proj_id)
|
||||
int add_emp_proj (isc_db_handle db, int emp_no, char *proj_id)
|
||||
{
|
||||
char exec_str[BUFLEN];
|
||||
isc_tr_handle trans = NULL;
|
||||
@ -204,12 +197,7 @@ ARGLIST(char *proj_id)
|
||||
/*
|
||||
* Set-up procedure parameters and clean-up old data.
|
||||
*/
|
||||
int get_params (ARG(void *, db),
|
||||
ARG(int *, emp_no),
|
||||
ARG(char *, proj_id))
|
||||
ARGLIST(void *db)
|
||||
ARGLIST(int *emp_no)
|
||||
ARGLIST(char *proj_id)
|
||||
int get_params (isc_db_handle db, int *emp_no, char *proj_id)
|
||||
{
|
||||
isc_tr_handle trans = NULL;
|
||||
ISC_STATUS_ARRAY status;
|
||||
@ -239,3 +227,4 @@ ARGLIST(char *proj_id)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@
|
||||
|
||||
#define BUFLEN 512
|
||||
|
||||
char * more_orders (void);
|
||||
char* more_orders (void);
|
||||
int do_trans (void);
|
||||
int cleanup (void);
|
||||
|
||||
@ -71,9 +71,7 @@ int Inp_ptr = 0;
|
||||
char *trans_str = "SET TRANSACTION ISOLATION LEVEL READ COMMITTED";
|
||||
|
||||
|
||||
int main (ARG(int, argc), ARG(char **, argv))
|
||||
ARGLIST(int argc)
|
||||
ARGLIST(char **argv)
|
||||
int main (int argc, char** argv)
|
||||
{
|
||||
char empdb[128];
|
||||
|
||||
@ -375,7 +373,8 @@ int cleanup (void)
|
||||
/*
|
||||
* Return the order number for the next sales order to be entered.
|
||||
*/
|
||||
char *more_orders (void)
|
||||
char* more_orders (void)
|
||||
{
|
||||
return Sales[Inp_ptr++];
|
||||
}
|
||||
|
||||
|
@ -40,9 +40,7 @@ char *sel_str1 =
|
||||
"SELECT currency FROM country WHERE country = 'Canada'";
|
||||
|
||||
|
||||
int main (ARG(int, argc), ARG(char **, argv))
|
||||
ARGLIST(int argc)
|
||||
ARGLIST(char **argv)
|
||||
int main (int argc, char** argv)
|
||||
{
|
||||
char *country = "Canada"; /* passed as a parameter */
|
||||
char *new_name = "CdnDollar"; /* passed as a parameter */
|
||||
@ -195,3 +193,4 @@ ARGLIST(char **argv)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -60,9 +60,7 @@ EXEC SQL
|
||||
|
||||
|
||||
|
||||
int main(ARG(int, argc), ARG(char **, argv))
|
||||
ARGLIST(int argc)
|
||||
ARGLIST(char **argv)
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
BASED_ON employee.salary salary;
|
||||
SQL_VARCHAR(5) job_code;
|
||||
|
@ -39,9 +39,7 @@
|
||||
#include "example.h"
|
||||
#include <ibase.h>
|
||||
|
||||
int main (ARG(int, argc), ARG(char **, argv))
|
||||
ARGLIST(int argc)
|
||||
ARGLIST(char **argv)
|
||||
int main (int argc, char** argv)
|
||||
{
|
||||
isc_db_handle db = NULL; /* database handle */
|
||||
isc_tr_handle trans = NULL; /* transaction handle */
|
||||
@ -218,3 +216,4 @@ ARGLIST(char **argv)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -50,10 +50,7 @@
|
||||
short event_flag = 0;
|
||||
void ast_routine (void *, USHORT, const UCHAR *);
|
||||
|
||||
int main(ARG(int, argc), ARG(char **, argv))
|
||||
ARGLIST(int argc)
|
||||
ARGLIST(char **argv)
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
isc_db_handle DB = NULL; /* database handle */
|
||||
isc_tr_handle trans = NULL; /* transaction handle */
|
||||
@ -97,11 +94,11 @@ ARGLIST(char **argv)
|
||||
sqlda->sqlvar[0].sqlind = &nullind;
|
||||
|
||||
if (isc_attach_database (status, 0, dbname, &DB, 0, NULL))
|
||||
{ERREXIT(status, 1)};
|
||||
{ERREXIT(status, 1)}
|
||||
|
||||
/* SET TRANSACTION ISOLATION LEVEL READ COMMITTED */
|
||||
if (isc_start_transaction (status, &trans, 1, &DB, 5, isc_tpb))
|
||||
{ERREXIT(status, 1)};
|
||||
{ERREXIT(status, 1)}
|
||||
|
||||
/* Prepare the query to look at the result tables */
|
||||
strcpy(query, " SELECT po_number FROM sales \
|
||||
@ -133,7 +130,7 @@ ARGLIST(char **argv)
|
||||
*/
|
||||
if(isc_que_events(status, &DB, &event_id, length,
|
||||
event_buffer, ast_routine, result_buffer))
|
||||
{ERREXIT(status, 1)};
|
||||
{ERREXIT(status, 1)}
|
||||
|
||||
|
||||
while (!ret)
|
||||
@ -172,7 +169,7 @@ ARGLIST(char **argv)
|
||||
|
||||
/* Select query to look at triggered events */
|
||||
if (isc_dsql_execute(status, &trans, &stmt, 1, NULL))
|
||||
{ERREXIT(status, 1)};
|
||||
{ERREXIT(status, 1)}
|
||||
|
||||
while (!isc_dsql_fetch(status, &stmt, 1, sqlda))
|
||||
{
|
||||
@ -186,7 +183,7 @@ ARGLIST(char **argv)
|
||||
/* Update current row */
|
||||
if(isc_dsql_execute_immediate(status, &DB,
|
||||
&trans, 0, update, 1, NULL))
|
||||
{ERREXIT(status, 1)};
|
||||
{ERREXIT(status, 1)}
|
||||
}
|
||||
/* Close cursor */
|
||||
isc_dsql_free_statement(status, &stmt, DSQL_close);
|
||||
@ -197,7 +194,7 @@ ARGLIST(char **argv)
|
||||
|
||||
if (isc_que_events(status, &DB, &event_id, length,
|
||||
event_buffer, ast_routine, result_buffer))
|
||||
{ERREXIT(status, 1)};
|
||||
{ERREXIT(status, 1)}
|
||||
}
|
||||
|
||||
/* This does not block, but as a sample program there is nothing
|
||||
@ -220,12 +217,7 @@ ARGLIST(char **argv)
|
||||
** event will land us here . PLus we get called once when the
|
||||
** program first starts.
|
||||
*/
|
||||
void ast_routine(ARG(void *, result),
|
||||
ARG(USHORT, length),
|
||||
ARG(const UCHAR *, updated))
|
||||
ARGLIST(void *result)
|
||||
ARGLIST(const UCHAR *updated)
|
||||
ARGLIST(USHORT length)
|
||||
void ast_routine(void *result, USHORT length, /*const*/ UCHAR *updated)
|
||||
{
|
||||
/* Set the global event flag */
|
||||
|
||||
|
@ -35,9 +35,7 @@
|
||||
#include <ibase.h>
|
||||
|
||||
|
||||
int main (ARG(int, argc), ARG(char **, argv))
|
||||
ARGLIST(int argc)
|
||||
ARGLIST(char **argv)
|
||||
int main (int argc, char** argv)
|
||||
{
|
||||
struct {
|
||||
short len;
|
||||
@ -179,3 +177,4 @@ ARGLIST(char **argv)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -45,9 +45,7 @@ isc_tr_handle trans = NULL; /* transaction handle */
|
||||
ISC_STATUS_ARRAY status; /* status vector */
|
||||
char Db_name[128];
|
||||
|
||||
int main (ARG(int, argc), ARG(char **, argv))
|
||||
ARGLIST(int argc)
|
||||
ARGLIST(char **argv)
|
||||
int main (int argc, char** argv)
|
||||
{
|
||||
int n = 0;
|
||||
char exec_str[MAXLEN];
|
||||
@ -139,9 +137,7 @@ ARGLIST(char **argv)
|
||||
* Construct an 'insert' statement from the supplied parameters.
|
||||
*/
|
||||
|
||||
int getline (ARG(char *, line), ARG(int, line_no))
|
||||
ARGLIST(char * line)
|
||||
ARGLIST(int line_no)
|
||||
int getline (char* line, int line_no)
|
||||
{
|
||||
static char * Dept_data[] =
|
||||
{
|
||||
@ -191,3 +187,4 @@ int cleanup (void)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -41,9 +41,7 @@
|
||||
/* This macro is used to declare structures representing SQL VARCHAR types */
|
||||
#define SQL_VARCHAR(len) struct {short vary_length; char vary_string[(len)+1];}
|
||||
|
||||
int main (ARG(int, argc), ARG(char **, argv))
|
||||
ARGLIST(int argc)
|
||||
ARGLIST(char **argv)
|
||||
int main (int argc, char** argv)
|
||||
{
|
||||
SQL_VARCHAR(LASTLEN) last_name;
|
||||
SQL_VARCHAR(FIRSTLEN) first_name;
|
||||
@ -157,3 +155,4 @@ ARGLIST(char **argv)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -49,9 +49,7 @@ isc_db_handle DB = NULL; /* database handle */
|
||||
isc_tr_handle trans = NULL; /* transaction handle */
|
||||
ISC_STATUS_ARRAY status; /* status vector */
|
||||
|
||||
int main (ARG(int, argc), ARG(char **, argv))
|
||||
ARGLIST(int argc)
|
||||
ARGLIST(char **argv)
|
||||
int main (int argc, char** argv)
|
||||
{
|
||||
char dept_no[4];
|
||||
double percent_inc;
|
||||
@ -152,9 +150,7 @@ ARGLIST(char **argv)
|
||||
* Get the department and percent parameters.
|
||||
*/
|
||||
|
||||
int get_input (ARG(char *,dept_no), ARG(double *,percent))
|
||||
ARGLIST(char *dept_no)
|
||||
ARGLIST(double *percent)
|
||||
int get_input (char *dept_no, double *percent)
|
||||
{
|
||||
if (Dept_data[Input_ptr] == 0)
|
||||
return 0;
|
||||
@ -166,3 +162,4 @@ ARGLIST(double *percent)
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -41,9 +41,7 @@ isc_tr_handle trans = 0; /* transaction handle */
|
||||
ISC_STATUS_ARRAY status; /* status vector */
|
||||
|
||||
|
||||
int main (ARG(int, argc), ARG(char **, argv))
|
||||
ARGLIST(int argc)
|
||||
ARGLIST(char **argv)
|
||||
int main (int argc, char** argv)
|
||||
{
|
||||
int num_cols, i;
|
||||
isc_stmt_handle stmt = NULL;
|
||||
@ -140,3 +138,4 @@ ARGLIST(char **argv)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -55,9 +55,7 @@ char *tot_str =
|
||||
|
||||
|
||||
|
||||
int main (ARG(int, argc), ARG(char **,argv))
|
||||
ARGLIST(int argc)
|
||||
ARGLIST(char **argv)
|
||||
int main (int argc, char** argv)
|
||||
{
|
||||
char dept_no[DEPTLEN + 2];
|
||||
char proj_id[PROJLEN + 2];
|
||||
@ -251,8 +249,7 @@ ARGLIST(char **argv)
|
||||
/*
|
||||
* Determine a percent increase for the department's budget.
|
||||
*/
|
||||
float increase_factor (ARG(double, budget))
|
||||
ARGLIST(double budget)
|
||||
float increase_factor (double budget)
|
||||
{
|
||||
if (budget < 100000L)
|
||||
return (float)0.15;
|
||||
@ -261,3 +258,4 @@ ARGLIST(double budget)
|
||||
else
|
||||
return (float)0.5;
|
||||
}
|
||||
|
||||
|
@ -36,9 +36,7 @@
|
||||
/* This macro is used to declare structures representing SQL VARCHAR types */
|
||||
#define SQL_VARCHAR(len) struct {short vary_length; char vary_string[(len)+1];}
|
||||
|
||||
int main (ARG(int, argc), ARG(char **, argv))
|
||||
ARGLIST(int argc)
|
||||
ARGLIST(char **argv)
|
||||
int main (int argc, char** argv)
|
||||
{
|
||||
SQL_VARCHAR(PROJLEN + 2) proj_name;
|
||||
char prod_type[TYPELEN + 2];
|
||||
@ -181,3 +179,4 @@ ARGLIST(char **argv)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -62,9 +62,7 @@ static char *Proj_data[] =
|
||||
|
||||
int Inp_ptr = 0;
|
||||
|
||||
int main (ARG(int, argc), ARG(char **, argv))
|
||||
ARGLIST(int argc)
|
||||
ARGLIST(char **argv)
|
||||
int main (int argc, char** argv)
|
||||
{
|
||||
char proj_id[PROJLEN + 1];
|
||||
char upd_stmt[BUFLEN + 1];
|
||||
@ -180,3 +178,4 @@ char *get_line (void)
|
||||
{
|
||||
return Proj_data[Inp_ptr++];
|
||||
}
|
||||
|
||||
|
@ -44,9 +44,7 @@ char *sel_str =
|
||||
/* Blob parameter buffer. */
|
||||
char bpb[] = {1,2,2,-4,-1,1,2,1,0};
|
||||
|
||||
int main (ARG(int, argc), ARG(char **, argv))
|
||||
ARGLIST(int argc)
|
||||
ARGLIST(char **argv)
|
||||
int main (int argc, char** argv)
|
||||
{
|
||||
char job_code[CODELEN + 2];
|
||||
short job_grade;
|
||||
@ -178,3 +176,4 @@ ARGLIST(char **argv)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <ibase.h>
|
||||
#include "example.h"
|
||||
@ -63,9 +64,7 @@ extern int fgetc();
|
||||
static char prevbuf[BUFFER_LENGTH + 1];
|
||||
static int width = 40;
|
||||
|
||||
int EXPORT desc_filter (ARG(SHORT, action), ARG(ISC_BLOB_CTL, control))
|
||||
ARGLIST(SHORT action)
|
||||
ARGLIST(ISC_BLOB_CTL control)
|
||||
int EXPORT desc_filter (SHORT action, ISC_BLOB_CTL control)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -118,14 +117,8 @@ switch (action)
|
||||
return FB_SUCCESS;
|
||||
}
|
||||
|
||||
static int caller (ARG(SHORT, action), ARG(ISC_BLOB_CTL, control),
|
||||
ARG(SHORT, buffer_length), ARG(CHAR*, buffer),
|
||||
ARG(SHORT*, return_length))
|
||||
ARGLIST(SHORT action)
|
||||
ARGLIST(ISC_BLOB_CTL control)
|
||||
ARGLIST(SHORT buffer_length)
|
||||
ARGLIST(CHAR *buffer)
|
||||
ARGLIST(SHORT *return_length)
|
||||
static int caller (SHORT action, ISC_BLOB_CTL control, SHORT buffer_length,
|
||||
CHAR *buffer, SHORT *return_length)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -156,9 +149,7 @@ return status;
|
||||
}
|
||||
|
||||
|
||||
static int dump_text (ARG(SHORT, action), ARG(ISC_BLOB_CTL, control))
|
||||
ARGLIST(SHORT action)
|
||||
ARGLIST(ISC_BLOB_CTL control)
|
||||
static int dump_text (SHORT action, ISC_BLOB_CTL control)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -229,9 +220,7 @@ ARGLIST(ISC_BLOB_CTL control)
|
||||
return FB_SUCCESS;
|
||||
}
|
||||
|
||||
static void set_statistics (ARG(char*, filename), ARG(ISC_BLOB_CTL, control))
|
||||
ARGLIST(char filename)
|
||||
ARGLIST(ISC_BLOB_CTL control)
|
||||
static void set_statistics (char* filename, ISC_BLOB_CTL control)
|
||||
{
|
||||
/*************************************
|
||||
*
|
||||
@ -293,9 +282,7 @@ control->ctl_number_segments = num_segs;
|
||||
control->ctl_total_length = length;
|
||||
}
|
||||
|
||||
static int read_text (ARG(SHORT, action), ARG(ISC_BLOB_CTL, control))
|
||||
ARGLIST(SHORT action)
|
||||
ARGLIST(ISC_BLOB_CTL control)
|
||||
static int read_text (SHORT action, ISC_BLOB_CTL control)
|
||||
{
|
||||
/**************************************
|
||||
*
|
||||
@ -337,3 +324,4 @@ for (;;)
|
||||
|
||||
return isc_segstr_eof;
|
||||
}
|
||||
|
||||
|
@ -19,3 +19,4 @@ DESCRIPTION 'api9f.dll'
|
||||
DATA READ WRITE
|
||||
EXPORTS
|
||||
desc_filter
|
||||
|
||||
|
@ -20,9 +20,6 @@
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
*/
|
||||
/*
|
||||
$Id: apifull.c,v 1.4 2004-01-21 07:16:04 skidder Exp $
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -77,9 +74,7 @@ int ret;
|
||||
#endif
|
||||
|
||||
|
||||
int main (ARG(int, argc), ARG(char **, argv))
|
||||
ARGLIST(int argc)
|
||||
ARGLIST(char **argv)
|
||||
int main (int argc, char** argv)
|
||||
{
|
||||
int query[MAXLEN];
|
||||
XSQLDA * sqlda;
|
||||
@ -126,7 +121,7 @@ ARGLIST(char **argv)
|
||||
/* We must pass the address of sqlda, in case it
|
||||
** gets re-allocated
|
||||
*/
|
||||
ret = process_statement((XSQLDA **) &sqlda,
|
||||
ret = process_statement(&sqlda,
|
||||
(char *) query);
|
||||
if (ret == 1)
|
||||
break;
|
||||
@ -138,12 +133,12 @@ ARGLIST(char **argv)
|
||||
if (isc_commit_transaction(status, &trans))
|
||||
{
|
||||
ERREXIT(status,1);
|
||||
};
|
||||
}
|
||||
|
||||
if (isc_detach_database(status, &db))
|
||||
{
|
||||
ERREXIT(status,1);
|
||||
};
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -156,10 +151,7 @@ ARGLIST(char **argv)
|
||||
** which will print the error and continue.
|
||||
*/
|
||||
|
||||
process_statement (ARG(XSQLDA **, sqldap),
|
||||
ARG(char *, query))
|
||||
ARGLIST(XSQLDA **sqldap)
|
||||
ARGLIST(char *query)
|
||||
process_statement (XSQLDA **sqldap, char *query)
|
||||
{
|
||||
int buffer[MAXLEN];
|
||||
XSQLDA *sqlda;
|
||||
@ -296,7 +288,7 @@ ARGLIST(char *query)
|
||||
if (isc_dsql_free_statement(status, &stmt, DSQL_close))
|
||||
{
|
||||
ERREXIT (status,2);
|
||||
};
|
||||
}
|
||||
|
||||
if (fetch_stat != 100L)
|
||||
{
|
||||
@ -309,8 +301,7 @@ ARGLIST(char *query)
|
||||
/*
|
||||
* Print column's data.
|
||||
*/
|
||||
void print_column (ARG(XSQLVAR *, var))
|
||||
ARGLIST(XSQLVAR *var)
|
||||
void print_column (XSQLVAR *var)
|
||||
{
|
||||
short dtype;
|
||||
char data[MAXLEN], *p;
|
||||
@ -444,7 +435,7 @@ ARGLIST(XSQLVAR *var)
|
||||
sprintf (p, "%*" ISC_INT64_FORMAT "d%",
|
||||
field_width,
|
||||
(ISC_INT64) value);
|
||||
};
|
||||
}
|
||||
break;
|
||||
|
||||
case SQL_FLOAT:
|
||||
@ -512,8 +503,7 @@ ARGLIST(XSQLVAR *var)
|
||||
* Prompt for and get input.
|
||||
* Statements are terminated by a semicolon.
|
||||
*/
|
||||
int get_statement (ARG(char *,buf))
|
||||
ARGLIST(char *buf)
|
||||
int get_statement (char *buf)
|
||||
{
|
||||
short c;
|
||||
char *p;
|
||||
|
@ -23,3 +23,4 @@ CODE PRELOAD MOVEABLE DISCARDABLE
|
||||
DATA PRELOAD MOVEABLE MULTIPLE
|
||||
HEAPSIZE 4096
|
||||
STACKSIZE 15000
|
||||
|
||||
|
@ -78,7 +78,7 @@ ISC_STATUS_ARRAY status;
|
||||
** FUNCTION PROTOTYPES
|
||||
*/
|
||||
|
||||
long FAR PASCAL _export WndProc (HWND, UINT, UINT, LONG) ;
|
||||
LRESULT CALLBACK _export WndProc (HWND, UINT, WPARAM, LPARAM) ;
|
||||
HWND InitApplication(int nCmdShow, HINSTANCE hPrevInstance);
|
||||
int InitEvent(EVENTBLK *lpEvent, long *DB,
|
||||
HWND hWnd, char *event);
|
||||
@ -112,7 +112,7 @@ int CHK_ERR(long *gds__status);
|
||||
*
|
||||
*
|
||||
****************************************************************/
|
||||
int PASCAL WinMain (HINSTANCE hInst, HINSTANCE hPrevInstance,
|
||||
int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInstance,
|
||||
LPSTR lpszCmdLine, int nCmdShow)
|
||||
{
|
||||
MSG msg;
|
||||
@ -301,8 +301,8 @@ void ReleaseEvents (EVENTBLK *lpEvent)
|
||||
* results from DefWindowProc otherwise
|
||||
*
|
||||
*****************************************************************/
|
||||
long FAR PASCAL _export WndProc (HWND hWnd, UINT message, UINT wParam,
|
||||
LONG lParam)
|
||||
LRESULT CALLBACK _export WndProc (HWND hWnd, UINT message, WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
EVENTBLK *lpEvent;
|
||||
ISC_STATUS_ARRAY Vector;
|
||||
@ -367,7 +367,7 @@ long FAR PASCAL _export WndProc (HWND hWnd, UINT message, UINT wParam,
|
||||
* none
|
||||
*
|
||||
*****************************************************************/
|
||||
void far AstRoutine (EVENTBLK *lpEvent, short length, char *updated)
|
||||
void AstRoutine (EVENTBLK *lpEvent, short length, char *updated)
|
||||
{
|
||||
char *ResultBuf = lpEvent->ResultBuf;
|
||||
|
||||
@ -420,3 +420,4 @@ int CHK_ERR (long *status)
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -31,3 +31,4 @@ STACKSIZE 15000
|
||||
EXPORTS
|
||||
; This needs an "_" prefix since it is a cdecl function
|
||||
_AstRoutine
|
||||
|
||||
|
@ -26,3 +26,4 @@ Events MENU
|
||||
MENUITEM "E&xit", 1
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,9 +41,7 @@ char *insert_date = "INSERT INTO dbinfo VALUES ('NOW')";
|
||||
EXEC SQL
|
||||
SET DATABASE db = COMPILETIME "employee.fdb";
|
||||
|
||||
int main(ARG(int, argc), ARG(char **, argv))
|
||||
ARGLIST(int argc)
|
||||
ARGLIST(char **argv)
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
||||
db = NULL;
|
||||
@ -133,8 +131,7 @@ ARGLIST(char **argv)
|
||||
* Print the status, the SQLCODE, and exit.
|
||||
* Also, indicate which operation the error occured on.
|
||||
*/
|
||||
void pr_error(ARG(char *, operation))
|
||||
ARGLIST(char *operation)
|
||||
void pr_error(char* operation)
|
||||
{
|
||||
printf("[\n");
|
||||
printf("PROBLEM ON \"%s\".\n", operation);
|
||||
@ -145,3 +142,4 @@ ARGLIST(char *operation)
|
||||
|
||||
printf("]\n");
|
||||
}
|
||||
|
||||
|
@ -47,9 +47,7 @@ EXEC SQL
|
||||
SET DATABASE empdb = "employee.fdb" RUNTIME :Db_name;
|
||||
|
||||
|
||||
int main(ARG(int, argc), ARG(char **, argv))
|
||||
ARGLIST(int argc)
|
||||
ARGLIST(char **argv)
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
BASED_ON department.department dept_name;
|
||||
BASED_ON department.dept_no dept_id;
|
||||
@ -132,8 +130,7 @@ MainError:
|
||||
/*
|
||||
* Construct an 'insert' statement from the supplied parameters.
|
||||
*/
|
||||
int get_line(ARG(char *, line))
|
||||
ARGLIST(char *line)
|
||||
int get_line(char* line)
|
||||
{
|
||||
if (Dept_data[Dept_ptr] == 0)
|
||||
return 0;
|
||||
@ -172,3 +169,4 @@ CleanErr:
|
||||
printf("SQLCODE=%d\n", SQLCODE);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
@ -43,9 +43,7 @@ EXEC SQL
|
||||
SET DATABASE empdb = "employee.fdb" RUNTIME :Db_name;
|
||||
|
||||
|
||||
int main(ARG(int, argc), ARG(char **, argv))
|
||||
ARGLIST(int argc)
|
||||
ARGLIST(char **argv)
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
||||
SQL_VARCHAR(15) first_name;
|
||||
@ -144,3 +142,4 @@ void print_error (void)
|
||||
isc_print_status(gds__status);
|
||||
printf("SQLCODE=%d\n", SQLCODE);
|
||||
}
|
||||
|
||||
|
@ -47,9 +47,7 @@ char *upd_str =
|
||||
"UPDATE department SET budget = ? * budget + budget WHERE dept_no = ?";
|
||||
|
||||
|
||||
int main(ARG(int, argc), ARG(char **, argv))
|
||||
ARGLIST(int argc)
|
||||
ARGLIST(char **argv)
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
BASED_ON department.dept_no dept_no;
|
||||
double percent_inc;
|
||||
@ -148,9 +146,7 @@ Error:
|
||||
/*
|
||||
* Get the department and percent parameters.
|
||||
*/
|
||||
int get_input(ARG(char *, dept_no), ARG(double *, percent))
|
||||
ARGLIST(char *dept_no)
|
||||
ARGLIST(double *percent)
|
||||
int get_input(char* dept_no, double* percent)
|
||||
{
|
||||
if (Dept_data[Input_ptr] == 0)
|
||||
return 0;
|
||||
@ -162,3 +158,4 @@ ARGLIST(double *percent)
|
||||
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
@ -40,9 +40,7 @@ EXEC SQL
|
||||
SET DATABASE empdb = "employee.fdb" RUNTIME :Db_name;
|
||||
|
||||
|
||||
int main(ARG(int, argc), ARG(char **, argv))
|
||||
ARGLIST(int argc)
|
||||
ARGLIST(char **argv)
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
short num_cols, i;
|
||||
XSQLDA *sqlda;
|
||||
@ -125,3 +123,4 @@ Error:
|
||||
printf("SQLCODE=%d\n", SQLCODE);
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
@ -20,9 +20,6 @@
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
*/
|
||||
/*
|
||||
$Id: dynfull.e,v 1.3 2004-01-21 07:16:05 skidder Exp $
|
||||
*/
|
||||
|
||||
#include "example.h"
|
||||
#include <stdio.h>
|
||||
@ -65,9 +62,7 @@ EXEC SQL
|
||||
|
||||
|
||||
|
||||
int main(ARG(int, argc), ARG(char **, argv))
|
||||
ARGLIST(int argc)
|
||||
ARGLIST(char **argv)
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
char query[MAXLEN];
|
||||
XSQLDA *sqlda;
|
||||
@ -114,10 +109,7 @@ ARGLIST(char **argv)
|
||||
}
|
||||
|
||||
|
||||
void process_statement(ARG(XSQLDA * *, sqldap),
|
||||
ARG(char *, query))
|
||||
ARGLIST(XSQLDA **sqldap)
|
||||
ARGLIST(char *query)
|
||||
void process_statement(XSQLDA** sqldap, char* query)
|
||||
{
|
||||
int buffer[MAXLEN];
|
||||
XSQLVAR *var;
|
||||
@ -250,8 +242,7 @@ Error:
|
||||
/*
|
||||
* Print column's data.
|
||||
*/
|
||||
void print_column(ARG(XSQLVAR *, var))
|
||||
ARGLIST(XSQLVAR *var)
|
||||
void print_column(XSQLVAR* var)
|
||||
{
|
||||
short dtype;
|
||||
char data[MAXLEN], *p;
|
||||
@ -384,7 +375,7 @@ ARGLIST(XSQLVAR *var)
|
||||
sprintf (p, "%*" ISC_INT64_FORMAT "d%",
|
||||
field_width,
|
||||
(ISC_INT64) value);
|
||||
};
|
||||
}
|
||||
break;
|
||||
|
||||
case SQL_FLOAT:
|
||||
@ -452,8 +443,7 @@ ARGLIST(XSQLVAR *var)
|
||||
* Prompt for and get input.
|
||||
* Statements are terminated by a semicolon.
|
||||
*/
|
||||
int get_statement(ARG(char *, buf))
|
||||
ARGLIST(char *buf)
|
||||
int get_statement(char* buf)
|
||||
{
|
||||
short c;
|
||||
char *p;
|
||||
@ -497,3 +487,4 @@ int get_statement(ARG(char *, buf))
|
||||
cnt++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,9 +21,6 @@
|
||||
* 2002.10.28 Sean Leyne - Code cleanup, removed obsolete "SGI" port
|
||||
*
|
||||
*/
|
||||
/*
|
||||
$Id: align.h,v 1.1 2003-07-10 23:04:39 brodsom Exp $
|
||||
*/
|
||||
|
||||
#ifdef VMS
|
||||
#define FB_ALIGN(n,b) (n)
|
||||
@ -50,3 +47,4 @@ $Id: align.h,v 1.1 2003-07-10 23:04:39 brodsom Exp $
|
||||
#ifndef FB_ALIGN
|
||||
#define FB_ALIGN(n,b) ((n+1) & ~1)
|
||||
#endif
|
||||
|
||||
|
@ -16,15 +16,6 @@
|
||||
* All Rights Reserved.
|
||||
* Contributor(s): ______________________________________.
|
||||
*/
|
||||
#if defined __STDC__ || defined __BORLANDC__ || defined _MSC_VER
|
||||
#define PROTO(args) args
|
||||
#define ARG(type, arg) type arg
|
||||
#define ARGLIST(arg)
|
||||
#else
|
||||
#define PROTO(args) ()
|
||||
#define ARG(type, arg) arg
|
||||
#define ARGLIST(arg) arg;
|
||||
#endif
|
||||
|
||||
#if defined __BORLANDC__ && defined __WIN32__
|
||||
#define EXPORT _export
|
||||
@ -33,3 +24,4 @@
|
||||
#endif
|
||||
|
||||
#define ERREXIT(status, rc) {isc_print_status(status); return rc;}
|
||||
|
||||
|
@ -67,7 +67,7 @@ int main (void)
|
||||
ROLLBACK RELEASE;
|
||||
printf("\nUNDONE.\n\n");
|
||||
}
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -99,3 +99,4 @@ void clean_up (void)
|
||||
EXEC SQL
|
||||
COMMIT WORK;
|
||||
}
|
||||
|
||||
|
@ -177,7 +177,7 @@ int main (void)
|
||||
|
||||
EXEC SQL
|
||||
DISCONNECT ALL;
|
||||
return (0);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
@ -196,7 +196,7 @@ int count_types (void)
|
||||
else
|
||||
if( pr_error())
|
||||
return 1;;
|
||||
return (0);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
@ -216,7 +216,7 @@ int count_records (void)
|
||||
else
|
||||
if( pr_error())
|
||||
return 1;;
|
||||
return (0);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
@ -230,5 +230,6 @@ long pr_error (void)
|
||||
isc_print_sqlerror(SQLCODE, isc_status);
|
||||
printf("\n");
|
||||
}
|
||||
return (SQLCODE);
|
||||
return (SQLCODE);
|
||||
}
|
||||
|
||||
|
@ -51,9 +51,7 @@ EXEC SQL
|
||||
|
||||
|
||||
|
||||
int main(ARG(int, argc), ARG(char **, argv))
|
||||
ARGLIST(int argc)
|
||||
ARGLIST(char **argv)
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
||||
if (argc > 1)
|
||||
@ -165,7 +163,7 @@ ARGLIST(char **argv)
|
||||
|
||||
EXEC SQL
|
||||
DISCONNECT empdb;
|
||||
return (0);
|
||||
return (0);
|
||||
err:
|
||||
isc_print_status(isc_status);
|
||||
return 1;
|
||||
|
@ -53,9 +53,7 @@ EXEC SQL
|
||||
END DECLARE SECTION;
|
||||
|
||||
|
||||
int main(ARG(int, argc), ARG(char **, argv))
|
||||
ARGLIST(int argc)
|
||||
ARGLIST(char **argv)
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int ret = 0;
|
||||
BASED_ON sales.po_number pon;
|
||||
@ -124,8 +122,7 @@ Error:
|
||||
/*
|
||||
* Initiate order processing for a newly received sales order.
|
||||
*/
|
||||
int process_order(ARG(char *, pon))
|
||||
ARGLIST(char * pon)
|
||||
int process_order(char* pon)
|
||||
{
|
||||
/*
|
||||
* This function would start a back-ground job, such as
|
||||
@ -141,3 +138,4 @@ ARGLIST(char * pon)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -35,9 +35,7 @@ EXEC SQL
|
||||
EXEC SQL
|
||||
END DECLARE SECTION;
|
||||
|
||||
int main(ARG(int, argc), ARG(char **, argv))
|
||||
ARGLIST(int argc)
|
||||
ARGLIST(char **argv)
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
EXEC SQL
|
||||
CONNECT empdb;
|
||||
@ -81,3 +79,4 @@ ARGLIST(char **argv)
|
||||
exit(0);
|
||||
|
||||
}
|
||||
|
||||
|
@ -85,6 +85,6 @@ int main (void)
|
||||
|
||||
EXEC SQL
|
||||
COMMIT RELEASE;
|
||||
exit(0);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
@ -92,13 +92,13 @@ AllDone:
|
||||
EXEC SQL
|
||||
COMMIT RELEASE;
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* Print the error, and exit.
|
||||
*/
|
||||
Error:
|
||||
isc_print_sqlerror((short)SQLCODE, gds__status);
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -87,11 +87,11 @@ int main (void)
|
||||
EXEC SQL
|
||||
COMMIT RELEASE;
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
Error1:
|
||||
pr_error();
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@ -156,11 +156,11 @@ void build_tree (void)
|
||||
|
||||
if (SQLCODE == 100)
|
||||
return;
|
||||
};
|
||||
}
|
||||
|
||||
Error2:
|
||||
pr_error();
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -171,3 +171,4 @@ void pr_error (void)
|
||||
{
|
||||
isc_print_sqlerror((short)SQLCODE, gds__status);
|
||||
}
|
||||
|
||||
|
@ -101,10 +101,10 @@ int main (void)
|
||||
EXEC SQL
|
||||
COMMIT WORK;
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
Error:
|
||||
isc_print_sqlerror((short) SQLCODE, gds__status);
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -105,10 +105,10 @@ int main (void)
|
||||
EXEC SQL
|
||||
COMMIT;
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
Error:
|
||||
isc_print_sqlerror((short) SQLCODE, gds__status);
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -126,11 +126,11 @@ int main (void)
|
||||
COMMIT RELEASE;
|
||||
|
||||
printf("\n\nAdded %d project descriptions.\n", rec_cnt);
|
||||
return 0;
|
||||
return 0;
|
||||
|
||||
Error:
|
||||
isc_print_sqlerror((short) SQLCODE, isc_status);
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -34,7 +34,7 @@ EXEC SQL INCLUDE SQLCA;
|
||||
void select_projects (short emp_no);
|
||||
void get_params (short *emp_no, char* proj_id);
|
||||
void pr_error (long status);
|
||||
int add_emp_proj (short emp_no,char * proj_id);
|
||||
void add_emp_proj (short emp_no,char * proj_id);
|
||||
|
||||
|
||||
|
||||
@ -73,8 +73,7 @@ int main (void)
|
||||
* Select from a stored procedure.
|
||||
* Procedure 'get_emp_proj' gets employee's projects.
|
||||
*/
|
||||
void select_projects(ARG(short, emp_no))
|
||||
ARGLIST(short emp_no)
|
||||
void select_projects(BASED_ON employee.emp_no emp_no)
|
||||
{
|
||||
BASED_ON project.proj_id proj_id;
|
||||
|
||||
@ -118,10 +117,7 @@ SelError:
|
||||
* Execute a stored procedure.
|
||||
* Procedure 'add_emp_proj' adds an employee to a project.
|
||||
*/
|
||||
add_emp_proj(ARG(short, emp_no),
|
||||
ARG(char *, proj_id))
|
||||
ARGLIST(BASED_ON employee.emp_no emp_no)
|
||||
ARGLIST(BASED_ON project.proj_id proj_id)
|
||||
void add_emp_proj(BASED_ON employee.emp_no emp_no, BASED_ON project.proj_id proj_id)
|
||||
{
|
||||
EXEC SQL
|
||||
WHENEVER SQLERROR GO TO AddError;
|
||||
@ -141,10 +137,7 @@ AddError:
|
||||
/*
|
||||
* Set-up procedure parameters and clean-up old data.
|
||||
*/
|
||||
void get_params(ARG(short *, emp_no),
|
||||
ARG(char *, proj_id))
|
||||
ARGLIST(BASED_ON employee.emp_no *emp_no)
|
||||
ARGLIST(BASED_ON project.proj_id proj_id)
|
||||
void get_params(BASED_ON employee.emp_no *emp_no, BASED_ON project.proj_id proj_id)
|
||||
{
|
||||
*emp_no = 8;
|
||||
strcpy(proj_id, "MAPDB");
|
||||
@ -165,8 +158,7 @@ CleanupError:
|
||||
/*
|
||||
* Print an error message.
|
||||
*/
|
||||
void pr_error(ARG(long, status))
|
||||
ARGLIST(long status)
|
||||
void pr_error(long status)
|
||||
{
|
||||
isc_print_sqlerror(SQLCODE, gds__status);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user