1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-02 09:02:37 +03:00

Run pgindent over ODBC source. We couldn't do this years ago because we

weren't the master source.  We are now, and it really needs it.
This commit is contained in:
Bruce Momjian
2001-02-10 07:01:19 +00:00
parent 505a828a66
commit 755a87332a
44 changed files with 10858 additions and 9067 deletions

View File

@ -1,9 +1,9 @@
/* File: statement.h
/* File: statement.h
*
* Description: See "statement.c"
* Description: See "statement.c"
*
* Comments: See "notice.txt" for copyright and license information.
* Comments: See "notice.txt" for copyright and license information.
*
*/
@ -33,21 +33,28 @@
#define TRUE (BOOL)1
#endif
typedef enum {
STMT_ALLOCATED, /* The statement handle is allocated, but not used so far */
STMT_READY, /* the statement is waiting to be executed */
STMT_PREMATURE, /* ODBC states that it is legal to call e.g. SQLDescribeCol before
a call to SQLExecute, but after SQLPrepare. To get all the necessary
information in such a case, we simply execute the query _before_ the
actual call to SQLExecute, so that statement is considered to be "premature".
*/
STMT_FINISHED, /* statement execution has finished */
STMT_EXECUTING /* statement execution is still going on */
} STMT_Status;
typedef enum
{
STMT_ALLOCATED, /* The statement handle is allocated, but
* not used so far */
STMT_READY, /* the statement is waiting to be executed */
STMT_PREMATURE, /* ODBC states that it is legal to call
* e.g. SQLDescribeCol before a call to
* SQLExecute, but after SQLPrepare. To
* get all the necessary information in
* such a case, we simply execute the
* query _before_ the actual call to
* SQLExecute, so that statement is
* considered to be "premature". */
STMT_FINISHED, /* statement execution has finished */
STMT_EXECUTING /* statement execution is still going on */
} STMT_Status;
#define STMT_TRUNCATED -2
#define STMT_INFO_ONLY -1 /* not an error message, just a notification to be returned by SQLError */
#define STMT_OK 0 /* will be interpreted as "no error pending" */
#define STMT_INFO_ONLY -1 /* not an error message, just a
* notification to be returned by SQLError */
#define STMT_OK 0 /* will be interpreted as "no error
* pending" */
#define STMT_EXEC_ERROR 1
#define STMT_STATUS_ERROR 2
#define STMT_SEQUENCE_ERROR 3
@ -77,7 +84,8 @@ typedef enum {
#define STMT_BAD_ERROR 27
/* statement types */
enum {
enum
{
STMT_TYPE_UNKNOWN = -2,
STMT_TYPE_OTHER = -1,
STMT_TYPE_SELECT = 0,
@ -95,7 +103,8 @@ enum {
/* Parsing status */
enum {
enum
{
STMT_PARSE_NONE = 0,
STMT_PARSE_COMPLETE,
STMT_PARSE_INCOMPLETE,
@ -103,92 +112,110 @@ enum {
};
/* Result style */
enum {
enum
{
STMT_FETCH_NONE = 0,
STMT_FETCH_NORMAL,
STMT_FETCH_EXTENDED,
};
typedef struct {
COL_INFO *col_info; /* cached SQLColumns info for this table */
char name[MAX_TABLE_LEN+1];
char alias[MAX_TABLE_LEN+1];
} TABLE_INFO;
typedef struct
{
COL_INFO *col_info; /* cached SQLColumns info for this table */
char name[MAX_TABLE_LEN + 1];
char alias[MAX_TABLE_LEN + 1];
} TABLE_INFO;
typedef struct {
TABLE_INFO *ti; /* resolve to explicit table names */
int precision;
int display_size;
int length;
int type;
char nullable;
char func;
char expr;
char quote;
char dquote;
char numeric;
char dot[MAX_TABLE_LEN+1];
char name[MAX_COLUMN_LEN+1];
char alias[MAX_COLUMN_LEN+1];
} FIELD_INFO;
typedef struct
{
TABLE_INFO *ti; /* resolve to explicit table names */
int precision;
int display_size;
int length;
int type;
char nullable;
char func;
char expr;
char quote;
char dquote;
char numeric;
char dot[MAX_TABLE_LEN + 1];
char name[MAX_COLUMN_LEN + 1];
char alias[MAX_COLUMN_LEN + 1];
} FIELD_INFO;
/******** Statement Handle ***********/
struct StatementClass_ {
ConnectionClass *hdbc; /* pointer to ConnectionClass this statement belongs to */
QResultClass *result; /* result of the current statement */
HSTMT FAR *phstmt;
struct StatementClass_
{
ConnectionClass *hdbc; /* pointer to ConnectionClass this
* statement belongs to */
QResultClass *result; /* result of the current statement */
HSTMT FAR *phstmt;
StatementOptions options;
STMT_Status status;
char *errormsg;
int errornumber;
STMT_Status status;
char *errormsg;
int errornumber;
/* information on bindings */
BindInfoClass *bindings; /* array to store the binding information */
/* information on bindings */
BindInfoClass *bindings; /* array to store the binding information */
BindInfoClass bookmark;
int bindings_allocated;
int bindings_allocated;
/* information on statement parameters */
int parameters_allocated;
ParameterInfoClass *parameters;
/* information on statement parameters */
int parameters_allocated;
ParameterInfoClass *parameters;
Int4 currTuple; /* current absolute row number (GetData, SetPos, SQLFetch) */
int save_rowset_size; /* saved rowset size in case of change/FETCH_NEXT */
int rowset_start; /* start of rowset (an absolute row number) */
int bind_row; /* current offset for Multiple row/column binding */
int last_fetch_count; /* number of rows retrieved in last fetch/extended fetch */
int current_col; /* current column for GetData -- used to handle multiple calls */
int lobj_fd; /* fd of the current large object */
Int4 currTuple; /* current absolute row number (GetData,
* SetPos, SQLFetch) */
int save_rowset_size; /* saved rowset size in case of
* change/FETCH_NEXT */
int rowset_start; /* start of rowset (an absolute row
* number) */
int bind_row; /* current offset for Multiple row/column
* binding */
int last_fetch_count; /* number of rows retrieved in
* last fetch/extended fetch */
int current_col; /* current column for GetData -- used to
* handle multiple calls */
int lobj_fd; /* fd of the current large object */
char *statement; /* if non--null pointer to the SQL statement that has been executed */
char *statement; /* if non--null pointer to the SQL
* statement that has been executed */
TABLE_INFO **ti;
FIELD_INFO **fi;
TABLE_INFO **ti;
FIELD_INFO **fi;
int nfld;
int ntab;
int parse_status;
int parse_status;
int statement_type; /* According to the defines above */
int data_at_exec; /* Number of params needing SQLPutData */
int current_exec_param; /* The current parameter for SQLPutData */
int statement_type; /* According to the defines above */
int data_at_exec; /* Number of params needing SQLPutData */
int current_exec_param; /* The current parameter for
* SQLPutData */
char put_data; /* Has SQLPutData been called yet? */
char put_data; /* Has SQLPutData been called yet? */
char errormsg_created; /* has an informative error msg been created? */
char manual_result; /* Is the statement result manually built? */
char prepare; /* is this statement a prepared statement or direct */
char errormsg_created; /* has an informative error msg
* been created? */
char manual_result; /* Is the statement result manually built? */
char prepare; /* is this statement a prepared statement
* or direct */
char internal; /* Is this statement being called internally? */
char internal; /* Is this statement being called
* internally? */
char cursor_name[MAX_CURSOR_LEN+1];
char cursor_name[MAX_CURSOR_LEN + 1];
char stmt_with_params[STD_STATEMENT_LEN]; /* statement after parameter substitution */
char stmt_with_params[STD_STATEMENT_LEN]; /* statement after
* parameter
* substitution */
};
#define SC_get_conn(a) (a->hdbc)
#define SC_get_conn(a) (a->hdbc)
#define SC_get_Result(a) (a->result);
/* options for SC_free_params() */
@ -197,22 +224,22 @@ struct StatementClass_ {
/* Statement prototypes */
StatementClass *SC_Constructor(void);
void InitializeStatementOptions(StatementOptions *opt);
char SC_Destructor(StatementClass *self);
int statement_type(char *statement);
char parse_statement(StatementClass *stmt);
void SC_pre_execute(StatementClass *self);
char SC_unbind_cols(StatementClass *self);
char SC_recycle_statement(StatementClass *self);
void InitializeStatementOptions(StatementOptions * opt);
char SC_Destructor(StatementClass * self);
int statement_type(char *statement);
char parse_statement(StatementClass * stmt);
void SC_pre_execute(StatementClass * self);
char SC_unbind_cols(StatementClass * self);
char SC_recycle_statement(StatementClass * self);
void SC_clear_error(StatementClass *self);
char SC_get_error(StatementClass *self, int *number, char **message);
char *SC_create_errormsg(StatementClass *self);
RETCODE SC_execute(StatementClass *self);
RETCODE SC_fetch(StatementClass *self);
void SC_free_params(StatementClass *self, char option);
void SC_log_error(char *func, char *desc, StatementClass *self);
unsigned long SC_get_bookmark(StatementClass *self);
void SC_clear_error(StatementClass * self);
char SC_get_error(StatementClass * self, int *number, char **message);
char *SC_create_errormsg(StatementClass * self);
RETCODE SC_execute(StatementClass * self);
RETCODE SC_fetch(StatementClass * self);
void SC_free_params(StatementClass * self, char option);
void SC_log_error(char *func, char *desc, StatementClass * self);
unsigned long SC_get_bookmark(StatementClass * self);
#endif