Commit 6852741c authored by Hiroshi Inoue's avatar Hiroshi Inoue

[2002-03-28]

1) Prepare to separate 4 kinds of Descriptor handles.
2) Detect the transaction status more naturally.
3) Improve Parse Statement functionality for the use
   of updatable cursors.
4) Improve updatable cursors.
5) Implement SQLGetDescField() and improve SQLColAttribute().
6) etc.
parent e6774dc3
This diff is collapsed.
...@@ -50,6 +50,9 @@ struct ParameterInfoClass_ ...@@ -50,6 +50,9 @@ struct ParameterInfoClass_
}; };
BindInfoClass *create_empty_bindings(int num_columns); BindInfoClass *create_empty_bindings(int num_columns);
void extend_bindings(StatementClass *stmt, int num_columns); void extend_column_bindings(ARDFields *opts, int num_columns);
void reset_a_column_binding(ARDFields *opts, int icol);
void extend_parameter_bindings(APDFields *opts, int num_columns);
void reset_a_parameter_binding(APDFields *opts, int ipar);
#endif #endif
...@@ -298,8 +298,8 @@ CC_Constructor() ...@@ -298,8 +298,8 @@ CC_Constructor()
/* Statements under this conn will inherit these options */ /* Statements under this conn will inherit these options */
InitializeStatementOptions(&rv->stmtOptions); InitializeStatementOptions(&rv->stmtOptions);
InitializeARDFields(&rv->ardOptions);
InitializeAPDFields(&rv->apdOptions);
} }
return rv; return rv;
} }
...@@ -381,8 +381,6 @@ CC_begin(ConnectionClass *self) ...@@ -381,8 +381,6 @@ CC_begin(ConnectionClass *self)
{ {
ret = QR_command_successful(res); ret = QR_command_successful(res);
QR_Destructor(res); QR_Destructor(res);
if (ret)
CC_set_in_trans(self);
} }
else else
return FALSE; return FALSE;
...@@ -403,9 +401,6 @@ CC_commit(ConnectionClass *self) ...@@ -403,9 +401,6 @@ CC_commit(ConnectionClass *self)
{ {
QResultClass *res = CC_send_query(self, "COMMIT", NULL, CLEAR_RESULT_ON_ABORT); QResultClass *res = CC_send_query(self, "COMMIT", NULL, CLEAR_RESULT_ON_ABORT);
mylog("CC_commit: sending COMMIT!\n"); mylog("CC_commit: sending COMMIT!\n");
CC_set_no_trans(self);
if (res != NULL) if (res != NULL)
{ {
ret = QR_command_successful(res); ret = QR_command_successful(res);
...@@ -429,9 +424,6 @@ CC_abort(ConnectionClass *self) ...@@ -429,9 +424,6 @@ CC_abort(ConnectionClass *self)
{ {
QResultClass *res = CC_send_query(self, "ROLLBACK", NULL, CLEAR_RESULT_ON_ABORT); QResultClass *res = CC_send_query(self, "ROLLBACK", NULL, CLEAR_RESULT_ON_ABORT);
mylog("CC_abort: sending ABORT!\n"); mylog("CC_abort: sending ABORT!\n");
CC_set_no_trans(self);
if (res != NULL) if (res != NULL)
QR_Destructor(res); QR_Destructor(res);
else else
...@@ -1118,6 +1110,23 @@ CC_get_error(ConnectionClass *self, int *number, char **message) ...@@ -1118,6 +1110,23 @@ CC_get_error(ConnectionClass *self, int *number, char **message)
} }
void CC_on_commit(ConnectionClass *conn, BOOL set_no_trans)
{
if (CC_is_in_trans(conn))
{
if (set_no_trans)
CC_set_no_trans(conn);
}
}
void CC_on_abort(ConnectionClass *conn, BOOL set_no_trans)
{
if (CC_is_in_trans(conn))
{
if (set_no_trans)
CC_set_no_trans(conn);
}
}
/* /*
* The "result_in" is only used by QR_next_tuple() to fetch another group of rows into * The "result_in" is only used by QR_next_tuple() to fetch another group of rows into
* the same existing QResultClass (this occurs when the tuple cache is depleted and * the same existing QResultClass (this occurs when the tuple cache is depleted and
...@@ -1134,7 +1143,8 @@ CC_send_query(ConnectionClass *self, char *query, QueryInfo *qi, UDWORD flag) ...@@ -1134,7 +1143,8 @@ CC_send_query(ConnectionClass *self, char *query, QueryInfo *qi, UDWORD flag)
*retres = NULL, *retres = NULL,
*res = NULL; *res = NULL;
BOOL clear_result_on_abort = ((flag & CLEAR_RESULT_ON_ABORT) != 0), BOOL clear_result_on_abort = ((flag & CLEAR_RESULT_ON_ABORT) != 0),
create_keyset = ((flag & CREATE_KEYSET) != 0); create_keyset = ((flag & CREATE_KEYSET) != 0),
issue_begin = ((flag & GO_INTO_TRANSACTION) != 0 && !CC_is_in_trans(self));
char swallow, char swallow,
*wq; *wq;
int id; int id;
...@@ -1146,7 +1156,8 @@ CC_send_query(ConnectionClass *self, char *query, QueryInfo *qi, UDWORD flag) ...@@ -1146,7 +1156,8 @@ CC_send_query(ConnectionClass *self, char *query, QueryInfo *qi, UDWORD flag)
query_completed = FALSE, query_completed = FALSE,
before_64 = PG_VERSION_LT(self, 6.4), before_64 = PG_VERSION_LT(self, 6.4),
aborted = FALSE, aborted = FALSE,
used_passed_result_object = FALSE; used_passed_result_object = FALSE,
set_no_trans;
/* ERROR_MSG_LENGTH is suffcient */ /* ERROR_MSG_LENGTH is suffcient */
static char msgbuffer[ERROR_MSG_LENGTH + 1]; static char msgbuffer[ERROR_MSG_LENGTH + 1];
...@@ -1173,7 +1184,7 @@ CC_send_query(ConnectionClass *self, char *query, QueryInfo *qi, UDWORD flag) ...@@ -1173,7 +1184,7 @@ CC_send_query(ConnectionClass *self, char *query, QueryInfo *qi, UDWORD flag)
{ {
self->errornumber = CONNECTION_COULD_NOT_SEND; self->errornumber = CONNECTION_COULD_NOT_SEND;
self->errormsg = "Could not send Query to backend"; self->errormsg = "Could not send Query to backend";
CC_set_no_trans(self); CC_on_abort(self, TRUE);
return NULL; return NULL;
} }
...@@ -1182,10 +1193,12 @@ CC_send_query(ConnectionClass *self, char *query, QueryInfo *qi, UDWORD flag) ...@@ -1182,10 +1193,12 @@ CC_send_query(ConnectionClass *self, char *query, QueryInfo *qi, UDWORD flag)
{ {
self->errornumber = CONNECTION_COULD_NOT_SEND; self->errornumber = CONNECTION_COULD_NOT_SEND;
self->errormsg = "Could not send Query to backend"; self->errormsg = "Could not send Query to backend";
CC_set_no_trans(self); CC_on_abort(self, TRUE);
return NULL; return NULL;
} }
if (issue_begin)
SOCK_put_n_char(sock, "begin;", 6);
SOCK_put_string(sock, query); SOCK_put_string(sock, query);
SOCK_flush_output(sock); SOCK_flush_output(sock);
...@@ -1193,7 +1206,7 @@ CC_send_query(ConnectionClass *self, char *query, QueryInfo *qi, UDWORD flag) ...@@ -1193,7 +1206,7 @@ CC_send_query(ConnectionClass *self, char *query, QueryInfo *qi, UDWORD flag)
{ {
self->errornumber = CONNECTION_COULD_NOT_SEND; self->errornumber = CONNECTION_COULD_NOT_SEND;
self->errormsg = "Could not send Query to backend"; self->errormsg = "Could not send Query to backend";
CC_set_no_trans(self); CC_on_abort(self, TRUE);
return NULL; return NULL;
} }
...@@ -1230,7 +1243,7 @@ CC_send_query(ConnectionClass *self, char *query, QueryInfo *qi, UDWORD flag) ...@@ -1230,7 +1243,7 @@ CC_send_query(ConnectionClass *self, char *query, QueryInfo *qi, UDWORD flag)
self->errormsg = "No response from the backend"; self->errormsg = "No response from the backend";
mylog("send_query: 'id' - %s\n", self->errormsg); mylog("send_query: 'id' - %s\n", self->errormsg);
CC_set_no_trans(self); CC_on_abort(self, TRUE);
ReadyToReturn = TRUE; ReadyToReturn = TRUE;
retres = NULL; retres = NULL;
break; break;
...@@ -1254,7 +1267,7 @@ CC_send_query(ConnectionClass *self, char *query, QueryInfo *qi, UDWORD flag) ...@@ -1254,7 +1267,7 @@ CC_send_query(ConnectionClass *self, char *query, QueryInfo *qi, UDWORD flag)
self->errornumber = CONNECTION_NO_RESPONSE; self->errornumber = CONNECTION_NO_RESPONSE;
self->errormsg = "No response from backend while receiving a portal query command"; self->errormsg = "No response from backend while receiving a portal query command";
mylog("send_query: 'C' - %s\n", self->errormsg); mylog("send_query: 'C' - %s\n", self->errormsg);
CC_set_no_trans(self); CC_on_abort(self, TRUE);
ReadyToReturn = TRUE; ReadyToReturn = TRUE;
retres = NULL; retres = NULL;
} }
...@@ -1270,6 +1283,24 @@ CC_send_query(ConnectionClass *self, char *query, QueryInfo *qi, UDWORD flag) ...@@ -1270,6 +1283,24 @@ CC_send_query(ConnectionClass *self, char *query, QueryInfo *qi, UDWORD flag)
mylog("send_query: setting cmdbuffer = '%s'\n", cmdbuffer); mylog("send_query: setting cmdbuffer = '%s'\n", cmdbuffer);
if (strnicmp(cmdbuffer, "BEGIN", 5) == 0)
{
CC_set_in_trans(self);
if (issue_begin)
{
issue_begin = FALSE;
continue;
}
}
else if (strnicmp(cmdbuffer, "COMMIT", 6) == 0)
CC_on_commit(self, TRUE);
else if (strnicmp(cmdbuffer, "ROLLBACK", 8) == 0)
CC_on_abort(self, TRUE);
else if (strnicmp(cmdbuffer, "END", 3) == 0)
CC_on_commit(self, TRUE);
else if (strnicmp(cmdbuffer, "ABORT", 5) == 0)
CC_on_abort(self, TRUE);
if (QR_command_successful(res)) if (QR_command_successful(res))
QR_set_status(res, PGRES_COMMAND_OK); QR_set_status(res, PGRES_COMMAND_OK);
QR_set_command(res, cmdbuffer); QR_set_command(res, cmdbuffer);
...@@ -1352,14 +1383,15 @@ CC_send_query(ConnectionClass *self, char *query, QueryInfo *qi, UDWORD flag) ...@@ -1352,14 +1383,15 @@ CC_send_query(ConnectionClass *self, char *query, QueryInfo *qi, UDWORD flag)
qlog("ERROR from backend during send_query: '%s'\n", msgbuffer); qlog("ERROR from backend during send_query: '%s'\n", msgbuffer);
/* We should report that an error occured. Zoltan */ /* We should report that an error occured. Zoltan */
set_no_trans = FALSE;
if (!strncmp(msgbuffer, "FATAL", 5)) if (!strncmp(msgbuffer, "FATAL", 5))
{ {
self->errornumber = CONNECTION_SERVER_REPORTED_ERROR; self->errornumber = CONNECTION_SERVER_REPORTED_ERROR;
CC_set_no_trans(self); set_no_trans = TRUE;
} }
else else
self->errornumber = CONNECTION_SERVER_REPORTED_WARNING; self->errornumber = CONNECTION_SERVER_REPORTED_WARNING;
CC_on_abort(self, set_no_trans);
QR_set_status(res, PGRES_FATAL_ERROR); QR_set_status(res, PGRES_FATAL_ERROR);
QR_set_message(res, msgbuffer); QR_set_message(res, msgbuffer);
QR_set_aborted(res, TRUE); QR_set_aborted(res, TRUE);
...@@ -1377,9 +1409,6 @@ CC_send_query(ConnectionClass *self, char *query, QueryInfo *qi, UDWORD flag) ...@@ -1377,9 +1409,6 @@ CC_send_query(ConnectionClass *self, char *query, QueryInfo *qi, UDWORD flag)
if (query_completed) if (query_completed)
{ {
res->next = QR_Constructor(); res->next = QR_Constructor();
if (create_keyset)
QR_set_haskeyset(res->next);
mylog("send_query: 'T' no result_in: res = %u\n", res->next);
if (!res->next) if (!res->next)
{ {
self->errornumber = CONNECTION_COULD_NOT_RECEIVE; self->errornumber = CONNECTION_COULD_NOT_RECEIVE;
...@@ -1388,6 +1417,9 @@ CC_send_query(ConnectionClass *self, char *query, QueryInfo *qi, UDWORD flag) ...@@ -1388,6 +1417,9 @@ CC_send_query(ConnectionClass *self, char *query, QueryInfo *qi, UDWORD flag)
retres = NULL; retres = NULL;
break; break;
} }
if (create_keyset)
QR_set_haskeyset(res->next);
mylog("send_query: 'T' no result_in: res = %u\n", res->next);
res = res->next; res = res->next;
if (qi) if (qi)
...@@ -1448,7 +1480,7 @@ CC_send_query(ConnectionClass *self, char *query, QueryInfo *qi, UDWORD flag) ...@@ -1448,7 +1480,7 @@ CC_send_query(ConnectionClass *self, char *query, QueryInfo *qi, UDWORD flag)
default: default:
self->errornumber = CONNECTION_BACKEND_CRAZY; self->errornumber = CONNECTION_BACKEND_CRAZY;
self->errormsg = "Unexpected protocol character from backend (send_query)"; self->errormsg = "Unexpected protocol character from backend (send_query)";
CC_set_no_trans(self); CC_on_abort(self, TRUE);
mylog("send_query: error - %s\n", self->errormsg); mylog("send_query: error - %s\n", self->errormsg);
ReadyToReturn = TRUE; ReadyToReturn = TRUE;
...@@ -1536,7 +1568,7 @@ CC_send_function(ConnectionClass *self, int fnid, void *result_buf, int *actual_ ...@@ -1536,7 +1568,7 @@ CC_send_function(ConnectionClass *self, int fnid, void *result_buf, int *actual_
{ {
self->errornumber = CONNECTION_COULD_NOT_SEND; self->errornumber = CONNECTION_COULD_NOT_SEND;
self->errormsg = "Could not send function to backend"; self->errormsg = "Could not send function to backend";
CC_set_no_trans(self); CC_on_abort(self, TRUE);
return FALSE; return FALSE;
} }
...@@ -1545,7 +1577,7 @@ CC_send_function(ConnectionClass *self, int fnid, void *result_buf, int *actual_ ...@@ -1545,7 +1577,7 @@ CC_send_function(ConnectionClass *self, int fnid, void *result_buf, int *actual_
{ {
self->errornumber = CONNECTION_COULD_NOT_SEND; self->errornumber = CONNECTION_COULD_NOT_SEND;
self->errormsg = "Could not send function to backend"; self->errormsg = "Could not send function to backend";
CC_set_no_trans(self); CC_on_abort(self, TRUE);
return FALSE; return FALSE;
} }
...@@ -1594,6 +1626,7 @@ CC_send_function(ConnectionClass *self, int fnid, void *result_buf, int *actual_ ...@@ -1594,6 +1626,7 @@ CC_send_function(ConnectionClass *self, int fnid, void *result_buf, int *actual_
case 'E': case 'E':
SOCK_get_string(sock, msgbuffer, ERROR_MSG_LENGTH); SOCK_get_string(sock, msgbuffer, ERROR_MSG_LENGTH);
self->errormsg = msgbuffer; self->errormsg = msgbuffer;
CC_on_abort(self, FALSE);
mylog("send_function(V): 'E' - %s\n", self->errormsg); mylog("send_function(V): 'E' - %s\n", self->errormsg);
qlog("ERROR from backend during send_function: '%s'\n", self->errormsg); qlog("ERROR from backend during send_function: '%s'\n", self->errormsg);
...@@ -1606,7 +1639,7 @@ CC_send_function(ConnectionClass *self, int fnid, void *result_buf, int *actual_ ...@@ -1606,7 +1639,7 @@ CC_send_function(ConnectionClass *self, int fnid, void *result_buf, int *actual_
default: default:
self->errornumber = CONNECTION_BACKEND_CRAZY; self->errornumber = CONNECTION_BACKEND_CRAZY;
self->errormsg = "Unexpected protocol character from backend (send_function, args)"; self->errormsg = "Unexpected protocol character from backend (send_function, args)";
CC_set_no_trans(self); CC_on_abort(self, TRUE);
mylog("send_function: error - %s\n", self->errormsg); mylog("send_function: error - %s\n", self->errormsg);
return FALSE; return FALSE;
...@@ -1640,7 +1673,7 @@ CC_send_function(ConnectionClass *self, int fnid, void *result_buf, int *actual_ ...@@ -1640,7 +1673,7 @@ CC_send_function(ConnectionClass *self, int fnid, void *result_buf, int *actual_
case 'E': case 'E':
SOCK_get_string(sock, msgbuffer, ERROR_MSG_LENGTH); SOCK_get_string(sock, msgbuffer, ERROR_MSG_LENGTH);
self->errormsg = msgbuffer; self->errormsg = msgbuffer;
CC_on_abort(self, FALSE);
mylog("send_function(G): 'E' - %s\n", self->errormsg); mylog("send_function(G): 'E' - %s\n", self->errormsg);
qlog("ERROR from backend during send_function: '%s'\n", self->errormsg); qlog("ERROR from backend during send_function: '%s'\n", self->errormsg);
...@@ -1661,7 +1694,7 @@ CC_send_function(ConnectionClass *self, int fnid, void *result_buf, int *actual_ ...@@ -1661,7 +1694,7 @@ CC_send_function(ConnectionClass *self, int fnid, void *result_buf, int *actual_
default: default:
self->errornumber = CONNECTION_BACKEND_CRAZY; self->errornumber = CONNECTION_BACKEND_CRAZY;
self->errormsg = "Unexpected protocol character from backend (send_function, result)"; self->errormsg = "Unexpected protocol character from backend (send_function, result)";
CC_set_no_trans(self); CC_on_abort(self, TRUE);
mylog("send_function: error - %s\n", self->errormsg); mylog("send_function: error - %s\n", self->errormsg);
return FALSE; return FALSE;
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "descriptor.h"
typedef enum typedef enum
...@@ -242,6 +243,8 @@ struct ConnectionClass_ ...@@ -242,6 +243,8 @@ struct ConnectionClass_
HENV henv; /* environment this connection was created HENV henv; /* environment this connection was created
* on */ * on */
StatementOptions stmtOptions; StatementOptions stmtOptions;
ARDFields ardOptions;
APDFields apdOptions;
char *errormsg; char *errormsg;
int errornumber; int errornumber;
CONN_Status status; CONN_Status status;
...@@ -315,8 +318,11 @@ void CC_lookup_pg_version(ConnectionClass *conn); ...@@ -315,8 +318,11 @@ void CC_lookup_pg_version(ConnectionClass *conn);
void CC_initialize_pg_version(ConnectionClass *conn); void CC_initialize_pg_version(ConnectionClass *conn);
void CC_log_error(const char *func, const char *desc, const ConnectionClass *self); void CC_log_error(const char *func, const char *desc, const ConnectionClass *self);
int CC_get_max_query_len(const ConnectionClass *self); int CC_get_max_query_len(const ConnectionClass *self);
void CC_on_commit(ConnectionClass *conn, BOOL set_no_trans);
void CC_on_abort(ConnectionClass *conn, BOOL set_no_trans);
/* CC_send_query_options */ /* CC_send_query_options */
#define CLEAR_RESULT_ON_ABORT 1L #define CLEAR_RESULT_ON_ABORT 1L
#define CREATE_KEYSET (1L << 1) /* create keyset for updatable curosrs */ #define CREATE_KEYSET (1L << 1) /* create keyset for updatable curosrs */
#define GO_INTO_TRANSACTION (1L << 2) /* issue begin in advance */
#endif #endif
This diff is collapsed.
/* File: descriptor.h
*
* Description: This file contains defines and declarations that are related to
* the entire driver.
*
* Comments: See "notice.txt" for copyright and license information.
*
* $Id: descriptor.h,v 1.1 2002/03/28 08:08:02 inoue Exp $
*
*/
#ifndef __DESCRIPTOR_H__
#define __DESCRIPTOR_H__
#include "psqlodbc.h"
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 column_size; /* precision in 2.x */
int decimal_digits; /* scale in 2.x */
int display_size;
int length;
int type;
char nullable;
char func;
char expr;
char quote;
char dquote;
char numeric;
char updatable;
char dot[MAX_TABLE_LEN + 1];
char name[MAX_COLUMN_LEN + 1];
char alias[MAX_COLUMN_LEN + 1];
} FIELD_INFO;
struct ARDFields_
{
StatementClass *stmt;
int rowset_size;
int bind_size; /* size of each structure if using Row
* Binding */
UInt2 *row_operation_ptr;
UInt4 *row_offset_ptr;
BindInfoClass *bookmark;
BindInfoClass *bindings;
int allocated;
};
struct APDFields_
{
StatementClass *stmt;
int paramset_size;
int param_bind_type; /* size of each structure if using Param
* Binding */
UInt2 *param_operation_ptr;
UInt4 *param_offset_ptr;
ParameterInfoClass *parameters;
int allocated;
};
struct IRDFields_
{
StatementClass *stmt;
UInt4 *rowsFetched;
UInt2 *rowStatusArray;
UInt4 nfields;
FIELD_INFO **fi;
};
struct IPDFields_
{
StatementClass *stmt;
UInt4 *param_processed_ptr;
UInt2 *param_status_ptr;
};
void InitializeARDFields(ARDFields *self);
void InitializeAPDFields(APDFields *self);
/* void InitializeIRDFields(IRDFields *self);
void InitializeIPDFiedls(IPDFields *self); */
void ARDFields_free(ARDFields *self);
void APDFields_free(APDFields *self);
void IRDFields_free(IRDFields *self);
void IPDFields_free(IPDFields *self);
void ARD_unbind_cols(ARDFields *self, BOOL freeall);
void APD_free_params(APDFields *self, char option);
#endif
...@@ -120,6 +120,9 @@ driver_optionsDraw(HWND hdlg, const ConnInfo *ci, int src, BOOL enable) ...@@ -120,6 +120,9 @@ driver_optionsDraw(HWND hdlg, const ConnInfo *ci, int src, BOOL enable)
} }
CheckDlgButton(hdlg, DRV_COMMLOG, comval->commlog); CheckDlgButton(hdlg, DRV_COMMLOG, comval->commlog);
#ifndef Q_LOG
EnableWindow(GetDlgItem(hdlg, DRV_COMMLOG), FALSE);
#endif /* Q_LOG */
CheckDlgButton(hdlg, DRV_OPTIMIZER, comval->disable_optimizer); CheckDlgButton(hdlg, DRV_OPTIMIZER, comval->disable_optimizer);
CheckDlgButton(hdlg, DRV_KSQO, comval->ksqo); CheckDlgButton(hdlg, DRV_KSQO, comval->ksqo);
CheckDlgButton(hdlg, DRV_UNIQUEINDEX, comval->unique_index); CheckDlgButton(hdlg, DRV_UNIQUEINDEX, comval->unique_index);
...@@ -153,6 +156,9 @@ driver_optionsDraw(HWND hdlg, const ConnInfo *ci, int src, BOOL enable) ...@@ -153,6 +156,9 @@ driver_optionsDraw(HWND hdlg, const ConnInfo *ci, int src, BOOL enable)
CheckDlgButton(hdlg, DRV_PARSE, comval->parse); CheckDlgButton(hdlg, DRV_PARSE, comval->parse);
CheckDlgButton(hdlg, DRV_CANCELASFREESTMT, comval->cancel_as_freestmt); CheckDlgButton(hdlg, DRV_CANCELASFREESTMT, comval->cancel_as_freestmt);
CheckDlgButton(hdlg, DRV_DEBUG, comval->debug); CheckDlgButton(hdlg, DRV_DEBUG, comval->debug);
#ifndef MY_LOG
EnableWindow(GetDlgItem(hdlg, DRV_DEBUG), FALSE);
#endif /* MY_LOG */
SetDlgItemInt(hdlg, DRV_CACHE_SIZE, comval->fetch_max, FALSE); SetDlgItemInt(hdlg, DRV_CACHE_SIZE, comval->fetch_max, FALSE);
SetDlgItemInt(hdlg, DRV_VARCHAR_SIZE, comval->max_varchar_size, FALSE); SetDlgItemInt(hdlg, DRV_VARCHAR_SIZE, comval->max_varchar_size, FALSE);
SetDlgItemInt(hdlg, DRV_LONGVARCHAR_SIZE, comval->max_longvarchar_size, TRUE); SetDlgItemInt(hdlg, DRV_LONGVARCHAR_SIZE, comval->max_longvarchar_size, TRUE);
...@@ -221,7 +227,7 @@ driver_options_update(HWND hdlg, ConnInfo *ci, BOOL updateProfile) ...@@ -221,7 +227,7 @@ driver_options_update(HWND hdlg, ConnInfo *ci, BOOL updateProfile)
int CALLBACK int CALLBACK
driver_optionsProc(HWND hdlg, driver_optionsProc(HWND hdlg,
WORD wMsg, UINT wMsg,
WPARAM wParam, WPARAM wParam,
LPARAM lParam) LPARAM lParam)
{ {
...@@ -293,7 +299,7 @@ driver_optionsProc(HWND hdlg, ...@@ -293,7 +299,7 @@ driver_optionsProc(HWND hdlg,
int CALLBACK int CALLBACK
ds_optionsProc(HWND hdlg, ds_optionsProc(HWND hdlg,
WORD wMsg, UINT wMsg,
WPARAM wParam, WPARAM wParam,
LPARAM lParam) LPARAM lParam)
{ {
...@@ -334,6 +340,10 @@ ds_optionsProc(HWND hdlg, ...@@ -334,6 +340,10 @@ ds_optionsProc(HWND hdlg,
CheckDlgButton(hdlg, DS_DISALLOWPREMATURE, ci->disallow_premature); CheckDlgButton(hdlg, DS_DISALLOWPREMATURE, ci->disallow_premature);
CheckDlgButton(hdlg, DS_LFCONVERSION, ci->lf_conversion); CheckDlgButton(hdlg, DS_LFCONVERSION, ci->lf_conversion);
CheckDlgButton(hdlg, DS_TRUEISMINUS1, ci->true_is_minus1); CheckDlgButton(hdlg, DS_TRUEISMINUS1, ci->true_is_minus1);
CheckDlgButton(hdlg, DS_UPDATABLECURSORS, ci->updatable_cursors);
#ifndef DRIVER_CURSOR_IMPLEMENT
EnableWindow(GetDlgItem(hdlg, DS_UPDATABLECURSORS), FALSE);
#endif /* DRIVER_CURSOR_IMPLEMENT */
EnableWindow(GetDlgItem(hdlg, DS_FAKEOIDINDEX), atoi(ci->show_oid_column)); EnableWindow(GetDlgItem(hdlg, DS_FAKEOIDINDEX), atoi(ci->show_oid_column));
...@@ -371,6 +381,9 @@ ds_optionsProc(HWND hdlg, ...@@ -371,6 +381,9 @@ ds_optionsProc(HWND hdlg,
ci->disallow_premature = IsDlgButtonChecked(hdlg, DS_DISALLOWPREMATURE); ci->disallow_premature = IsDlgButtonChecked(hdlg, DS_DISALLOWPREMATURE);
ci->lf_conversion = IsDlgButtonChecked(hdlg, DS_LFCONVERSION); ci->lf_conversion = IsDlgButtonChecked(hdlg, DS_LFCONVERSION);
ci->true_is_minus1 = IsDlgButtonChecked(hdlg, DS_TRUEISMINUS1); ci->true_is_minus1 = IsDlgButtonChecked(hdlg, DS_TRUEISMINUS1);
#ifdef DRIVER_CURSOR_IMPLEMENT
ci->updatable_cursors = IsDlgButtonChecked(hdlg, DS_UPDATABLECURSORS);
#endif /* DRIVER_CURSOR_IMPLEMENT */
/* OID Options */ /* OID Options */
sprintf(ci->fake_oid_index, "%d", IsDlgButtonChecked(hdlg, DS_FAKEOIDINDEX)); sprintf(ci->fake_oid_index, "%d", IsDlgButtonChecked(hdlg, DS_FAKEOIDINDEX));
......
...@@ -169,11 +169,11 @@ void SetDlgStuff(HWND hdlg, const ConnInfo *ci); ...@@ -169,11 +169,11 @@ void SetDlgStuff(HWND hdlg, const ConnInfo *ci);
void GetDlgStuff(HWND hdlg, ConnInfo *ci); void GetDlgStuff(HWND hdlg, ConnInfo *ci);
int CALLBACK driver_optionsProc(HWND hdlg, int CALLBACK driver_optionsProc(HWND hdlg,
WORD wMsg, UINT wMsg,
WPARAM wParam, WPARAM wParam,
LPARAM lParam); LPARAM lParam);
int CALLBACK ds_optionsProc(HWND hdlg, int CALLBACK ds_optionsProc(HWND hdlg,
WORD wMsg, UINT wMsg,
WPARAM wParam, WPARAM wParam,
LPARAM lParam); LPARAM lParam);
#endif /* WIN32 */ #endif /* WIN32 */
......
...@@ -94,7 +94,7 @@ PGAPI_StmtError( HSTMT hstmt, ...@@ -94,7 +94,7 @@ PGAPI_StmtError( HSTMT hstmt,
StatementClass *stmt = (StatementClass *) hstmt; StatementClass *stmt = (StatementClass *) hstmt;
char *msg; char *msg;
int status; int status;
BOOL partial_ok = ((flag & PODBC_ALLOW_PARTIAL_EXTRACT) != 0), BOOL partial_ok = ((flag & PODBC_ALLOW_PARTIAL_EXTRACT) != 0),
clear_str = ((flag & PODBC_ERROR_CLEAR) != 0); clear_str = ((flag & PODBC_ERROR_CLEAR) != 0);
SWORD msglen, stapos, wrtlen, pcblen; SWORD msglen, stapos, wrtlen, pcblen;
...@@ -275,6 +275,9 @@ PGAPI_StmtError( HSTMT hstmt, ...@@ -275,6 +275,9 @@ PGAPI_StmtError( HSTMT hstmt,
case STMT_OPERATION_INVALID: case STMT_OPERATION_INVALID:
strcpy(szSqlState, "S1011"); strcpy(szSqlState, "S1011");
break; break;
case STMT_INVALID_DESCRIPTOR_IDENTIFIER:
strcpy(szSqlState, "HY091");
break;
case STMT_INVALID_OPTION_IDENTIFIER: case STMT_INVALID_OPTION_IDENTIFIER:
strcpy(szSqlState, "HY092"); strcpy(szSqlState, "HY092");
break; break;
...@@ -313,6 +316,7 @@ PGAPI_ConnectError( HDBC hdbc, ...@@ -313,6 +316,7 @@ PGAPI_ConnectError( HDBC hdbc,
BOOL once_again = FALSE; BOOL once_again = FALSE;
SWORD msglen; SWORD msglen;
mylog("**** PGAPI_ConnectError: hdbc=%u <%d>\n", hdbc, cbErrorMsgMax);
if (RecNumber != 1) if (RecNumber != 1)
return SQL_NO_DATA_FOUND; return SQL_NO_DATA_FOUND;
if (cbErrorMsgMax < 0) if (cbErrorMsgMax < 0)
...@@ -361,6 +365,7 @@ PGAPI_ConnectError( HDBC hdbc, ...@@ -361,6 +365,7 @@ PGAPI_ConnectError( HDBC hdbc,
strcpy(szSqlState, "IM002"); strcpy(szSqlState, "IM002");
/* data source not found */ /* data source not found */
break; break;
case CONNECTION_SERVER_NOT_REACHED:
case CONN_OPENDB_ERROR: case CONN_OPENDB_ERROR:
strcpy(szSqlState, "08001"); strcpy(szSqlState, "08001");
/* unable to connect to data source */ /* unable to connect to data source */
...@@ -413,6 +418,7 @@ PGAPI_ConnectError( HDBC hdbc, ...@@ -413,6 +418,7 @@ PGAPI_ConnectError( HDBC hdbc,
break; break;
} }
mylog(" szSqlState = '%s',len=%d, szError='%s'\n", szSqlState, msglen, szErrorMsg);
if (once_again) if (once_again)
{ {
conn->errornumber = status; conn->errornumber = status;
...@@ -436,6 +442,7 @@ PGAPI_EnvError( HENV henv, ...@@ -436,6 +442,7 @@ PGAPI_EnvError( HENV henv,
char *msg; char *msg;
int status; int status;
mylog("**** PGAPI_EnvError: henv=%u <%d>\n", henv, cbErrorMsgMax);
if (RecNumber != 1) if (RecNumber != 1)
return SQL_NO_DATA_FOUND; return SQL_NO_DATA_FOUND;
if (cbErrorMsgMax < 0) if (cbErrorMsgMax < 0)
...@@ -567,7 +574,7 @@ EN_Destructor(EnvironmentClass *self) ...@@ -567,7 +574,7 @@ EN_Destructor(EnvironmentClass *self)
mylog("exit EN_Destructor: rv = %d\n", rv); mylog("exit EN_Destructor: rv = %d\n", rv);
#ifdef _MEMORY_DEBUG_ #ifdef _MEMORY_DEBUG_
debug_memory_inouecheck(); debug_memory_check();
#endif /* _MEMORY_DEBUG_ */ #endif /* _MEMORY_DEBUG_ */
return rv; return rv;
} }
......
...@@ -206,9 +206,12 @@ PGAPI_Execute( ...@@ -206,9 +206,12 @@ PGAPI_Execute(
{ {
static char *func = "PGAPI_Execute"; static char *func = "PGAPI_Execute";
StatementClass *stmt = (StatementClass *) hstmt; StatementClass *stmt = (StatementClass *) hstmt;
APDFields *opts;
IPDFields *ipdopts;
ConnectionClass *conn; ConnectionClass *conn;
int i, int i,
retval, start_row, end_row; retval, start_row, end_row;
int cursor_type, scroll_concurrency;
mylog("%s: entering...\n", func); mylog("%s: entering...\n", func);
...@@ -219,6 +222,9 @@ PGAPI_Execute( ...@@ -219,6 +222,9 @@ PGAPI_Execute(
return SQL_INVALID_HANDLE; return SQL_INVALID_HANDLE;
} }
opts = SC_get_APD(stmt);
cursor_type = stmt->options.cursor_type;
scroll_concurrency = stmt->options.scroll_concurrency;
/* /*
* If the statement is premature, it means we already executed it from * If the statement is premature, it means we already executed it from
* an SQLPrepare/SQLDescribeCol type of scenario. So just return * an SQLPrepare/SQLDescribeCol type of scenario. So just return
...@@ -297,24 +303,25 @@ PGAPI_Execute( ...@@ -297,24 +303,25 @@ PGAPI_Execute(
if (start_row = stmt->exec_start_row, start_row < 0) if (start_row = stmt->exec_start_row, start_row < 0)
start_row = 0; start_row = 0;
if (end_row = stmt->exec_end_row, end_row < 0) if (end_row = stmt->exec_end_row, end_row < 0)
end_row = stmt->options.paramset_size - 1; end_row = opts->paramset_size - 1;
if (stmt->exec_current_row < 0) if (stmt->exec_current_row < 0)
stmt->exec_current_row = start_row; stmt->exec_current_row = start_row;
ipdopts = SC_get_IPD(stmt);
if (stmt->exec_current_row == start_row) if (stmt->exec_current_row == start_row)
{ {
if (stmt->options.param_processed_ptr) if (ipdopts->param_processed_ptr)
*stmt->options.param_processed_ptr = 0; *ipdopts->param_processed_ptr = 0;
SC_recycle_statement(stmt); SC_recycle_statement(stmt);
} }
next_param_row: next_param_row:
#if (ODBCVER >= 0x0300) #if (ODBCVER >= 0x0300)
if (stmt->options.param_operation_ptr) if (opts->param_operation_ptr)
{ {
while (stmt->options.param_operation_ptr[stmt->exec_current_row] == SQL_PARAM_IGNORE) while (opts->param_operation_ptr[stmt->exec_current_row] == SQL_PARAM_IGNORE)
{ {
if (stmt->options.param_status_ptr) if (ipdopts->param_status_ptr)
stmt->options.param_status_ptr[stmt->exec_current_row] = SQL_PARAM_UNUSED; ipdopts->param_status_ptr[stmt->exec_current_row] = SQL_PARAM_UNUSED;
if (stmt->exec_current_row >= end_row) if (stmt->exec_current_row >= end_row)
{ {
stmt->exec_current_row = -1; stmt->exec_current_row = -1;
...@@ -335,16 +342,16 @@ next_param_row: ...@@ -335,16 +342,16 @@ next_param_row:
* execute of this statement? Therefore check for params and * execute of this statement? Therefore check for params and
* re-copy. * re-copy.
*/ */
UInt4 offset = stmt->options.param_offset_ptr ? *stmt->options.param_offset_ptr : 0; UInt4 offset = opts->param_offset_ptr ? *opts->param_offset_ptr : 0;
Int4 bind_size = stmt->options.param_bind_type; Int4 bind_size = opts->param_bind_type;
Int4 current_row = stmt->exec_current_row < 0 ? 0 : stmt->exec_current_row; Int4 current_row = stmt->exec_current_row < 0 ? 0 : stmt->exec_current_row;
stmt->data_at_exec = -1; stmt->data_at_exec = -1;
for (i = 0; i < stmt->parameters_allocated; i++) for (i = 0; i < opts->allocated; i++)
{ {
Int4 *pcVal = stmt->parameters[i].used; Int4 *pcVal = opts->parameters[i].used;
stmt->parameters[i].data_at_exec = FALSE; opts->parameters[i].data_at_exec = FALSE;
if (pcVal) if (pcVal)
{ {
if (bind_size > 0) if (bind_size > 0)
...@@ -352,10 +359,10 @@ next_param_row: ...@@ -352,10 +359,10 @@ next_param_row:
else else
pcVal = (Int4 *)((char *)pcVal + offset + sizeof(SDWORD) * current_row); pcVal = (Int4 *)((char *)pcVal + offset + sizeof(SDWORD) * current_row);
if (*pcVal == SQL_DATA_AT_EXEC || *pcVal <= SQL_LEN_DATA_AT_EXEC_OFFSET) if (*pcVal == SQL_DATA_AT_EXEC || *pcVal <= SQL_LEN_DATA_AT_EXEC_OFFSET)
stmt->parameters[i].data_at_exec = TRUE; opts->parameters[i].data_at_exec = TRUE;
} }
/* Check for data at execution parameters */ /* Check for data at execution parameters */
if (stmt->parameters[i].data_at_exec) if (opts->parameters[i].data_at_exec)
{ {
if (stmt->data_at_exec < 0) if (stmt->data_at_exec < 0)
stmt->data_at_exec = 1; stmt->data_at_exec = 1;
...@@ -394,22 +401,22 @@ next_param_row: ...@@ -394,22 +401,22 @@ next_param_row:
retval = SC_execute(stmt); retval = SC_execute(stmt);
if (retval != SQL_ERROR) if (retval != SQL_ERROR)
{ {
if (stmt->options.param_processed_ptr) if (ipdopts->param_processed_ptr)
(*stmt->options.param_processed_ptr)++; (*ipdopts->param_processed_ptr)++;
} }
#if (ODBCVER >= 0x0300) #if (ODBCVER >= 0x0300)
if (stmt->options.param_status_ptr) if (ipdopts->param_status_ptr)
{ {
switch (retval) switch (retval)
{ {
case SQL_SUCCESS: case SQL_SUCCESS:
stmt->options.param_status_ptr[stmt->exec_current_row] = SQL_PARAM_SUCCESS; ipdopts->param_status_ptr[stmt->exec_current_row] = SQL_PARAM_SUCCESS;
break; break;
case SQL_SUCCESS_WITH_INFO: case SQL_SUCCESS_WITH_INFO:
stmt->options.param_status_ptr[stmt->exec_current_row] = SQL_PARAM_SUCCESS_WITH_INFO; ipdopts->param_status_ptr[stmt->exec_current_row] = SQL_PARAM_SUCCESS_WITH_INFO;
break; break;
default: default:
stmt->options.param_status_ptr[stmt->exec_current_row] = SQL_PARAM_ERROR; ipdopts->param_status_ptr[stmt->exec_current_row] = SQL_PARAM_ERROR;
break; break;
} }
} }
...@@ -447,7 +454,6 @@ next_param_row: ...@@ -447,7 +454,6 @@ next_param_row:
} }
} }
/* we are now in a transaction */ /* we are now in a transaction */
CC_set_in_trans(conn);
res = CC_send_query(conn, stmt->stmt_with_params, NULL, CLEAR_RESULT_ON_ABORT); res = CC_send_query(conn, stmt->stmt_with_params, NULL, CLEAR_RESULT_ON_ABORT);
if (!res) if (!res)
{ {
...@@ -464,13 +470,18 @@ next_param_row: ...@@ -464,13 +470,18 @@ next_param_row:
{ {
if (issued_begin) if (issued_begin)
CC_commit(conn); CC_commit(conn);
else if (!in_trans && begin_included)
CC_set_no_trans(conn);
} }
stmt->status = STMT_FINISHED; stmt->status = STMT_FINISHED;
return SQL_SUCCESS; return SQL_SUCCESS;
} }
else else if (stmt->options.cursor_type != cursor_type ||
stmt->options.scroll_concurrency != scroll_concurrency)
{
stmt->errornumber = STMT_OPTION_VALUE_CHANGED;
stmt->errormsg = "cursor updatability changed";
return SQL_SUCCESS_WITH_INFO;
}
else
return SQL_SUCCESS; return SQL_SUCCESS;
} }
...@@ -534,11 +545,10 @@ PGAPI_Transact( ...@@ -534,11 +545,10 @@ PGAPI_Transact(
mylog("PGAPI_Transact: sending on conn %d '%s'\n", conn, stmt_string); mylog("PGAPI_Transact: sending on conn %d '%s'\n", conn, stmt_string);
res = CC_send_query(conn, stmt_string, NULL, CLEAR_RESULT_ON_ABORT); res = CC_send_query(conn, stmt_string, NULL, CLEAR_RESULT_ON_ABORT);
CC_set_no_trans(conn);
if (!res) if (!res)
{ {
/* error msg will be in the connection */ /* error msg will be in the connection */
CC_on_abort(conn, TRUE);
CC_log_error(func, "", conn); CC_log_error(func, "", conn);
return SQL_ERROR; return SQL_ERROR;
} }
...@@ -548,6 +558,7 @@ PGAPI_Transact( ...@@ -548,6 +558,7 @@ PGAPI_Transact(
if (!ok) if (!ok)
{ {
CC_on_abort(conn, TRUE);
CC_log_error(func, "", conn); CC_log_error(func, "", conn);
return SQL_ERROR; return SQL_ERROR;
} }
...@@ -697,6 +708,8 @@ PGAPI_ParamData( ...@@ -697,6 +708,8 @@ PGAPI_ParamData(
{ {
static char *func = "PGAPI_ParamData"; static char *func = "PGAPI_ParamData";
StatementClass *stmt = (StatementClass *) hstmt; StatementClass *stmt = (StatementClass *) hstmt;
APDFields *opts;
IPDFields *ipdopts;
int i, int i,
retval; retval;
ConnInfo *ci; ConnInfo *ci;
...@@ -709,8 +722,9 @@ PGAPI_ParamData( ...@@ -709,8 +722,9 @@ PGAPI_ParamData(
return SQL_INVALID_HANDLE; return SQL_INVALID_HANDLE;
} }
ci = &(SC_get_conn(stmt)->connInfo); ci = &(SC_get_conn(stmt)->connInfo);
opts = SC_get_APD(stmt);
mylog("%s: data_at_exec=%d, params_alloc=%d\n", func, stmt->data_at_exec, stmt->parameters_allocated); mylog("%s: data_at_exec=%d, params_alloc=%d\n", func, stmt->data_at_exec, opts->allocated);
if (stmt->data_at_exec < 0) if (stmt->data_at_exec < 0)
{ {
...@@ -720,7 +734,7 @@ PGAPI_ParamData( ...@@ -720,7 +734,7 @@ PGAPI_ParamData(
return SQL_ERROR; return SQL_ERROR;
} }
if (stmt->data_at_exec > stmt->parameters_allocated) if (stmt->data_at_exec > opts->allocated)
{ {
stmt->errornumber = STMT_SEQUENCE_ERROR; stmt->errornumber = STMT_SEQUENCE_ERROR;
stmt->errormsg = "Too many execution-time parameters were present"; stmt->errormsg = "Too many execution-time parameters were present";
...@@ -748,6 +762,7 @@ PGAPI_ParamData( ...@@ -748,6 +762,7 @@ PGAPI_ParamData(
} }
/* Done, now copy the params and then execute the statement */ /* Done, now copy the params and then execute the statement */
ipdopts = SC_get_IPD(stmt);
if (stmt->data_at_exec == 0) if (stmt->data_at_exec == 0)
{ {
int end_row; int end_row;
...@@ -761,28 +776,29 @@ PGAPI_ParamData( ...@@ -761,28 +776,29 @@ PGAPI_ParamData(
retval = SC_execute(stmt); retval = SC_execute(stmt);
if (retval != SQL_ERROR) if (retval != SQL_ERROR)
{ {
if (stmt->options.param_processed_ptr) if (ipdopts->param_processed_ptr)
(*stmt->options.param_processed_ptr)++; (*ipdopts->param_processed_ptr)++;
} }
#if (ODBCVER >= 0x0300) #if (ODBCVER >= 0x0300)
if (stmt->options.param_status_ptr) if (ipdopts->param_status_ptr)
{ {
switch (retval) switch (retval)
{ {
case SQL_SUCCESS: case SQL_SUCCESS:
stmt->options.param_status_ptr[stmt->exec_current_row] = SQL_PARAM_SUCCESS; ipdopts->param_status_ptr[stmt->exec_current_row] = SQL_PARAM_SUCCESS;
break; break;
case SQL_SUCCESS_WITH_INFO: case SQL_SUCCESS_WITH_INFO:
stmt->options.param_status_ptr[stmt->exec_current_row] = SQL_PARAM_SUCCESS_WITH_INFO; ipdopts->param_status_ptr[stmt->exec_current_row] = SQL_PARAM_SUCCESS_WITH_INFO;
break; break;
default: default:
stmt->options.param_status_ptr[stmt->exec_current_row] = SQL_PARAM_ERROR; ipdopts->param_status_ptr[stmt->exec_current_row] = SQL_PARAM_ERROR;
break; break;
} }
} }
#endif /* ODBCVER */ #endif /* ODBCVER */
if (stmt->exec_end_row < 0) end_row = stmt->exec_end_row;
end_row = stmt->options.paramset_size - 1; if (end_row < 0)
end_row = opts->paramset_size - 1;
if (retval == SQL_ERROR || if (retval == SQL_ERROR ||
stmt->exec_current_row >= end_row) stmt->exec_current_row >= end_row)
{ {
...@@ -800,14 +816,14 @@ PGAPI_ParamData( ...@@ -800,14 +816,14 @@ PGAPI_ParamData(
i = stmt->current_exec_param >= 0 ? stmt->current_exec_param + 1 : 0; i = stmt->current_exec_param >= 0 ? stmt->current_exec_param + 1 : 0;
/* At least 1 data at execution parameter, so Fill in the token value */ /* At least 1 data at execution parameter, so Fill in the token value */
for (; i < stmt->parameters_allocated; i++) for (; i < opts->allocated; i++)
{ {
if (stmt->parameters[i].data_at_exec) if (opts->parameters[i].data_at_exec)
{ {
stmt->data_at_exec--; stmt->data_at_exec--;
stmt->current_exec_param = i; stmt->current_exec_param = i;
stmt->put_data = FALSE; stmt->put_data = FALSE;
*prgbValue = stmt->parameters[i].buffer; /* token */ *prgbValue = opts->parameters[i].buffer; /* token */
break; break;
} }
} }
...@@ -828,6 +844,7 @@ PGAPI_PutData( ...@@ -828,6 +844,7 @@ PGAPI_PutData(
{ {
static char *func = "PGAPI_PutData"; static char *func = "PGAPI_PutData";
StatementClass *stmt = (StatementClass *) hstmt; StatementClass *stmt = (StatementClass *) hstmt;
APDFields *opts;
int old_pos, int old_pos,
retval; retval;
ParameterInfoClass *current_param; ParameterInfoClass *current_param;
...@@ -841,6 +858,7 @@ PGAPI_PutData( ...@@ -841,6 +858,7 @@ PGAPI_PutData(
return SQL_INVALID_HANDLE; return SQL_INVALID_HANDLE;
} }
opts = SC_get_APD(stmt);
if (stmt->current_exec_param < 0) if (stmt->current_exec_param < 0)
{ {
stmt->errornumber = STMT_SEQUENCE_ERROR; stmt->errornumber = STMT_SEQUENCE_ERROR;
...@@ -849,7 +867,7 @@ PGAPI_PutData( ...@@ -849,7 +867,7 @@ PGAPI_PutData(
return SQL_ERROR; return SQL_ERROR;
} }
current_param = &(stmt->parameters[stmt->current_exec_param]); current_param = &(opts->parameters[stmt->current_exec_param]);
if (!stmt->put_data) if (!stmt->put_data)
{ /* first call */ { /* first call */
......
This diff is collapsed.
...@@ -53,14 +53,13 @@ PGAPI_GetInfo30(HDBC hdbc, UWORD fInfoType, PTR rgbInfoValue, ...@@ -53,14 +53,13 @@ PGAPI_GetInfo30(HDBC hdbc, UWORD fInfoType, PTR rgbInfoValue,
| SQL_CA1_RELATIVE | SQL_CA1_BOOKMARK | SQL_CA1_RELATIVE | SQL_CA1_BOOKMARK
| SQL_CA1_LOCK_NO_CHANGE | SQL_CA1_POS_POSITION | SQL_CA1_LOCK_NO_CHANGE | SQL_CA1_POS_POSITION
| SQL_CA1_POS_UPDATE | SQL_CA1_POS_DELETE | SQL_CA1_POS_UPDATE | SQL_CA1_POS_DELETE
| SQL_CA1_POS_REFRESH); | SQL_CA1_POS_REFRESH | SQL_CA1_BULK_ADD
if (ci->drivers.lie)
value |= (SQL_CA1_BULK_ADD
| SQL_CA1_BULK_UPDATE_BY_BOOKMARK | SQL_CA1_BULK_UPDATE_BY_BOOKMARK
| SQL_CA1_BULK_DELETE_BY_BOOKMARK | SQL_CA1_BULK_DELETE_BY_BOOKMARK
| SQL_CA1_BULK_FETCH_BY_BOOKMARK | SQL_CA1_BULK_FETCH_BY_BOOKMARK
);
| SQL_CA1_LOCK_EXCLUSIVE if (ci->drivers.lie)
value |= (SQL_CA1_LOCK_EXCLUSIVE
| SQL_CA1_LOCK_UNLOCK | SQL_CA1_LOCK_UNLOCK
| SQL_CA1_POSITIONED_UPDATE | SQL_CA1_POSITIONED_UPDATE
| SQL_CA1_POSITIONED_DELETE | SQL_CA1_POSITIONED_DELETE
...@@ -72,9 +71,10 @@ PGAPI_GetInfo30(HDBC hdbc, UWORD fInfoType, PTR rgbInfoValue, ...@@ -72,9 +71,10 @@ PGAPI_GetInfo30(HDBC hdbc, UWORD fInfoType, PTR rgbInfoValue,
value = 0; value = 0;
if (ci->updatable_cursors || ci->drivers.lie) if (ci->updatable_cursors || ci->drivers.lie)
value |= (SQL_CA2_OPT_ROWVER_CONCURRENCY value |= (SQL_CA2_OPT_ROWVER_CONCURRENCY
| SQL_CA2_SENSITIVITY_ADDITIONS
| SQL_CA2_SENSITIVITY_DELETIONS | SQL_CA2_SENSITIVITY_DELETIONS
| SQL_CA2_SENSITIVITY_UPDATES); | SQL_CA2_SENSITIVITY_UPDATES
/* | SQL_CA2_SENSITIVITY_ADDITIONS */
);
if (ci->drivers.lie) if (ci->drivers.lie)
value |= (SQL_CA2_READ_ONLY_CONCURRENCY value |= (SQL_CA2_READ_ONLY_CONCURRENCY
| SQL_CA2_LOCK_CONCURRENCY | SQL_CA2_LOCK_CONCURRENCY
...@@ -97,19 +97,21 @@ PGAPI_GetInfo30(HDBC hdbc, UWORD fInfoType, PTR rgbInfoValue, ...@@ -97,19 +97,21 @@ PGAPI_GetInfo30(HDBC hdbc, UWORD fInfoType, PTR rgbInfoValue,
len = 4; len = 4;
value = SQL_CA1_NEXT | SQL_CA1_ABSOLUTE value = SQL_CA1_NEXT | SQL_CA1_ABSOLUTE
| SQL_CA1_RELATIVE | SQL_CA1_BOOKMARK | SQL_CA1_RELATIVE | SQL_CA1_BOOKMARK
| SQL_CA1_LOCK_NO_CHANGE | SQL_CA1_POS_POSITION; | SQL_CA1_LOCK_NO_CHANGE | SQL_CA1_POS_POSITION
| SQL_CA1_POS_REFRESH;
if (ci->updatable_cursors) if (ci->updatable_cursors)
value |= (SQL_CA1_POS_UPDATE | SQL_CA1_POS_DELETE value |= (SQL_CA1_POS_UPDATE | SQL_CA1_POS_DELETE
| SQL_CA1_POS_REFRESH); );
break; break;
case SQL_STATIC_CURSOR_ATTRIBUTES2: case SQL_STATIC_CURSOR_ATTRIBUTES2:
len = 4; len = 4;
value = 0; value = SQL_CA2_READ_ONLY_CONCURRENCY;
if (ci->updatable_cursors) if (ci->updatable_cursors)
value |= (SQL_CA2_OPT_ROWVER_CONCURRENCY value |= (SQL_CA2_OPT_ROWVER_CONCURRENCY
| SQL_CA2_SENSITIVITY_ADDITIONS /* | SQL_CA2_SENSITIVITY_ADDITIONS
| SQL_CA2_SENSITIVITY_DELETIONS | SQL_CA2_SENSITIVITY_DELETIONS
| SQL_CA2_SENSITIVITY_UPDATES); | SQL_CA2_SENSITIVITY_UPDATES */
);
break; break;
case SQL_ODBC_INTERFACE_CONFORMANCE: case SQL_ODBC_INTERFACE_CONFORMANCE:
......
...@@ -115,6 +115,11 @@ mylog(char *fmt,...) ...@@ -115,6 +115,11 @@ mylog(char *fmt,...)
va_end(args); va_end(args);
} }
} }
#else
void
MyLog(char *fmt,...)
{
}
#endif #endif
......
...@@ -36,17 +36,18 @@ ...@@ -36,17 +36,18 @@
#define MYLOGDIR "/tmp" #define MYLOGDIR "/tmp"
#else #else
#define MYLOGDIR "c:" #define MYLOGDIR "c:"
#endif #endif /* WIN32 */
extern void mylog(char *fmt,...); extern void mylog(char *fmt,...);
#define inolog mylog /* for really temporary debug */
#else #else
#ifndef WIN32 #ifndef WIN32
#define mylog(args...) /* GNU convention for variable arguments */ #define mylog(args...) /* GNU convention for variable arguments */
#else #else
#define mylog /* mylog */ extern void MyLog(char *fmt,...);
#endif #define mylog if (0) MyLog /* mylog */
#endif #endif /* WIN32 */
#endif /* MY_LOG */
#define inolog mylog /* for really temporary debug */
#ifdef Q_LOG #ifdef Q_LOG
#define QLOGFILE "psqlodbc_" #define QLOGFILE "psqlodbc_"
...@@ -64,6 +65,7 @@ extern void qlog(char *fmt,...); ...@@ -64,6 +65,7 @@ extern void qlog(char *fmt,...);
#define qlog /* qlog */ #define qlog /* qlog */
#endif #endif
#endif #endif
#define inoqlog qlog
#ifndef WIN32 #ifndef WIN32
#define DIRSEPARATOR "/" #define DIRSEPARATOR "/"
......
...@@ -59,7 +59,7 @@ pg_CS CS_Table[] = ...@@ -59,7 +59,7 @@ pg_CS CS_Table[] =
{ "OTHER", OTHER } { "OTHER", OTHER }
}; };
int static int
pg_ismb(int characterset_code) pg_ismb(int characterset_code)
{ {
int i=0,MB_CHARACTERSET[]={EUC_JP,EUC_CN,EUC_KR,EUC_TW,UTF8,MULE_INTERNAL,SJIS,BIG5,GBK,UHC,JOHAB}; int i=0,MB_CHARACTERSET[]={EUC_JP,EUC_CN,EUC_KR,EUC_TW,UTF8,MULE_INTERNAL,SJIS,BIG5,GBK,UHC,JOHAB};
...@@ -228,8 +228,8 @@ pg_CS_stat(int stat,unsigned int character,int characterset_code) ...@@ -228,8 +228,8 @@ pg_CS_stat(int stat,unsigned int character,int characterset_code)
character > 0xa0) character > 0xa0)
stat = 3; stat = 3;
else if (stat == 3 || else if (stat == 3 ||
(stat < 2 && stat < 2 &&
character > 0xa0)) character > 0xa0)
stat = 2; stat = 2;
else if (stat == 2) else if (stat == 2)
stat = 1; stat = 1;
......
...@@ -86,7 +86,4 @@ void encoded_str_constr(encoded_str *encstr, int ccsc, const char *str); ...@@ -86,7 +86,4 @@ void encoded_str_constr(encoded_str *encstr, int ccsc, const char *str);
#define make_encoded_str(encstr, conn, str) encoded_str_constr(encstr, conn->ccsc, str) #define make_encoded_str(encstr, conn, str) encoded_str_constr(encstr, conn->ccsc, str)
extern int encoded_nextchar(encoded_str *encstr); extern int encoded_nextchar(encoded_str *encstr);
extern int encoded_byte_check(encoded_str *encstr, int abspos); extern int encoded_byte_check(encoded_str *encstr, int abspos);
/* This doesn't seem to be called by anyone, bjm 2002-03-24 */
extern int pg_ismb(int characterset_code);
#define check_client_encoding(X) pg_CS_name(pg_CS_code(X)) #define check_client_encoding(X) pg_CS_name(pg_CS_code(X))
...@@ -204,8 +204,9 @@ SQLFetch(HSTMT StatementHandle) ...@@ -204,8 +204,9 @@ SQLFetch(HSTMT StatementHandle)
if (conn->driver_version >= 0x0300) if (conn->driver_version >= 0x0300)
{ {
SQLUSMALLINT *rowStatusArray = stmt->options.rowStatusArray; IRDFields *irdopts = SC_get_IRD(stmt);
SQLINTEGER *pcRow = stmt->options.rowsFetched; SQLUSMALLINT *rowStatusArray = irdopts->rowStatusArray;
SQLINTEGER *pcRow = irdopts->rowsFetched;
mylog("[[%s]]", func); mylog("[[%s]]", func);
return PGAPI_ExtendedFetch(StatementHandle, SQL_FETCH_NEXT, 0, return PGAPI_ExtendedFetch(StatementHandle, SQL_FETCH_NEXT, 0,
......
This diff is collapsed.
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* *
* Classes: n/a * Classes: n/a
* *
* API functions: SQLColAttributeW, SQLGetStmtW, SQLSetStmtW, * API functions: SQLColAttributeW, SQLGetStmtAttrW, SQLSetStmtAttrW,
SQLSetConnectAttrW, SQLGetConnectAttrW, SQLSetConnectAttrW, SQLGetConnectAttrW,
SQLGetDescFieldW, SQLGetDescRecW, SQLGetDiagFieldW, SQLGetDescFieldW, SQLGetDescRecW, SQLGetDiagFieldW,
SQLGetDiagRecW, SQLGetDiagRecW,
...@@ -75,6 +75,48 @@ RETCODE SQL_API SQLSetConnectAttrW(HDBC hdbc, ...@@ -75,6 +75,48 @@ RETCODE SQL_API SQLSetConnectAttrW(HDBC hdbc,
return ret; return ret;
} }
/* new function */
RETCODE SQL_API
SQLSetDescFieldW(SQLHDESC DescriptorHandle, SQLSMALLINT RecNumber,
SQLSMALLINT FieldIdentifier, PTR Value,
SQLINTEGER BufferLength)
{
RETCODE ret;
UInt4 vallen;
char *uval = NULL;
BOOL val_alloced = FALSE;
mylog("[SQLSetDescFieldW]");
if (BufferLength > 0)
{
uval = ucs2_to_utf8(Value, BufferLength / 2, &vallen);
val_alloced = TRUE;
}
else
{
uval = Value;
vallen = BufferLength;
}
ret = PGAPI_SetDescField(DescriptorHandle, RecNumber, FieldIdentifier,
uval, vallen);
if (val_alloced)
free(uval);
return ret;
}
RETCODE SQL_API
SQLGetDescFieldW(SQLHDESC hdesc, SQLSMALLINT iRecord, SQLSMALLINT iField,
PTR rgbValue, SQLINTEGER cbValueMax,
SQLINTEGER *pcbValue)
{
RETCODE ret;
char *qstr = NULL, *mtxt = NULL;
mylog("[SQLGetDescFieldW]");
ret = PGAPI_GetDescField(hdesc, iRecord, iField, rgbValue,
cbValueMax, pcbValue);
return ret;
}
RETCODE SQL_API SQLGetDiagRecW(SWORD fHandleType, RETCODE SQL_API SQLGetDiagRecW(SWORD fHandleType,
SQLHANDLE handle, SQLHANDLE handle,
SQLSMALLINT iRecord, SQLSMALLINT iRecord,
...@@ -131,7 +173,25 @@ RETCODE SQL_API SQLColAttributeW( ...@@ -131,7 +173,25 @@ RETCODE SQL_API SQLColAttributeW(
RETCODE ret; RETCODE ret;
mylog("[SQLColAttributeW]"); mylog("[SQLColAttributeW]");
switch (fDescType)
{
case SQL_DESC_BASE_COLUMN_NAME:
case SQL_DESC_BASE_TABLE_NAME:
case SQL_DESC_CATALOG_NAME:
case SQL_DESC_LABEL:
case SQL_DESC_LITERAL_PREFIX:
case SQL_DESC_LITERAL_SUFFIX:
case SQL_DESC_LOCAL_TYPE_NAME:
case SQL_DESC_NAME:
case SQL_DESC_SCHEMA_NAME:
case SQL_DESC_TABLE_NAME:
case SQL_DESC_TYPE_NAME:
case SQL_COLUMN_NAME:
break;
}
ret = PGAPI_ColAttributes(hstmt, icol, fDescType, rgbDesc, ret = PGAPI_ColAttributes(hstmt, icol, fDescType, rgbDesc,
cbDescMax, pcbDesc, pfDesc); cbDescMax, pcbDesc, pfDesc);
return ret; return ret;
} }
...@@ -53,9 +53,9 @@ set_statement_option(ConnectionClass *conn, ...@@ -53,9 +53,9 @@ set_statement_option(ConnectionClass *conn,
case SQL_BIND_TYPE: case SQL_BIND_TYPE:
/* now support multi-column and multi-row binding */ /* now support multi-column and multi-row binding */
if (conn) if (conn)
conn->stmtOptions.bind_size = vParam; conn->ardOptions.bind_size = vParam;
if (stmt) if (stmt)
stmt->options.bind_size = vParam; SC_get_ARD(stmt)->bind_size = vParam;
break; break;
case SQL_CONCURRENCY: case SQL_CONCURRENCY:
...@@ -173,7 +173,7 @@ set_statement_option(ConnectionClass *conn, ...@@ -173,7 +173,7 @@ set_statement_option(ConnectionClass *conn,
*/ */
if (stmt && stmt->save_rowset_size <= 0 && stmt->last_fetch_count > 0) if (stmt && stmt->save_rowset_size <= 0 && stmt->last_fetch_count > 0)
stmt->save_rowset_size = stmt->options.rowset_size; stmt->save_rowset_size = SC_get_ARD(stmt)->rowset_size;
if (vParam < 1) if (vParam < 1)
{ {
...@@ -182,9 +182,9 @@ set_statement_option(ConnectionClass *conn, ...@@ -182,9 +182,9 @@ set_statement_option(ConnectionClass *conn,
} }
if (conn) if (conn)
conn->stmtOptions.rowset_size = vParam; conn->ardOptions.rowset_size = vParam;
if (stmt) if (stmt)
stmt->options.rowset_size = vParam; SC_get_ARD(stmt)->rowset_size = vParam;
break; break;
case SQL_SIMULATE_CURSOR: /* NOT SUPPORTED */ case SQL_SIMULATE_CURSOR: /* NOT SUPPORTED */
...@@ -590,16 +590,16 @@ PGAPI_GetStmtOption( ...@@ -590,16 +590,16 @@ PGAPI_GetStmtOption(
break; break;
case SQL_BIND_TYPE: case SQL_BIND_TYPE:
*((SDWORD *) pvParam) = stmt->options.bind_size; *((SDWORD *) pvParam) = SC_get_ARD(stmt)->bind_size;
break; break;
case SQL_CONCURRENCY: /* NOT REALLY SUPPORTED */ case SQL_CONCURRENCY: /* NOT REALLY SUPPORTED */
mylog("GetStmtOption(): SQL_CONCURRENCY\n"); mylog("GetStmtOption(): SQL_CONCURRENCY %d\n", stmt->options.scroll_concurrency);
*((SDWORD *) pvParam) = stmt->options.scroll_concurrency; *((SDWORD *) pvParam) = stmt->options.scroll_concurrency;
break; break;
case SQL_CURSOR_TYPE: /* PARTIAL SUPPORT */ case SQL_CURSOR_TYPE: /* PARTIAL SUPPORT */
mylog("GetStmtOption(): SQL_CURSOR_TYPE\n"); mylog("GetStmtOption(): SQL_CURSOR_TYPE %d\n", stmt->options.cursor_type);
*((SDWORD *) pvParam) = stmt->options.cursor_type; *((SDWORD *) pvParam) = stmt->options.cursor_type;
break; break;
...@@ -630,7 +630,7 @@ PGAPI_GetStmtOption( ...@@ -630,7 +630,7 @@ PGAPI_GetStmtOption(
break; break;
case SQL_ROWSET_SIZE: case SQL_ROWSET_SIZE:
*((SDWORD *) pvParam) = stmt->options.rowset_size; *((SDWORD *) pvParam) = SC_get_ARD(stmt)->rowset_size;
break; break;
case SQL_SIMULATE_CURSOR: /* NOT SUPPORTED */ case SQL_SIMULATE_CURSOR: /* NOT SUPPORTED */
......
This diff is collapsed.
This diff is collapsed.
...@@ -280,5 +280,8 @@ RETCODE SQL_API PGAPI_SetStmtAttr(HSTMT StatementHandle, ...@@ -280,5 +280,8 @@ RETCODE SQL_API PGAPI_SetStmtAttr(HSTMT StatementHandle,
RETCODE SQL_API PGAPI_SetDescField(SQLHDESC DescriptorHandle, RETCODE SQL_API PGAPI_SetDescField(SQLHDESC DescriptorHandle,
SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier, SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier,
PTR Value, SQLINTEGER BufferLength); PTR Value, SQLINTEGER BufferLength);
RETCODE SQL_API PGAPI_GetDescField(SQLHDESC DescriptorHandle,
SQLSMALLINT RecNumber, SQLSMALLINT FieldIdentifier,
PTR Value, SQLINTEGER BufferLength, SQLINTEGER *StringLength);
#endif /* ODBCVER */ #endif /* ODBCVER */
#endif /* define_PG_API_FUNC_H__ */ #endif /* define_PG_API_FUNC_H__ */
This diff is collapsed.
...@@ -72,16 +72,22 @@ extern Int2 sqlTypes[]; ...@@ -72,16 +72,22 @@ extern Int2 sqlTypes[];
Int4 sqltype_to_pgtype(StatementClass *stmt, Int2 fSqlType); Int4 sqltype_to_pgtype(StatementClass *stmt, Int2 fSqlType);
Int2 pgtype_to_sqltype(StatementClass *stmt, Int4 type); Int2 pgtype_to_concise_type(StatementClass *stmt, Int4 type);
Int2 pgtype_to_sqldesctype(StatementClass *stmt, Int4 type);
Int2 pgtype_to_datetime_sub(StatementClass *stmt, Int4 type);
Int2 pgtype_to_ctype(StatementClass *stmt, Int4 type); Int2 pgtype_to_ctype(StatementClass *stmt, Int4 type);
char *pgtype_to_name(StatementClass *stmt, Int4 type); char *pgtype_to_name(StatementClass *stmt, Int4 type);
/* These functions can use static numbers or result sets(col parameter) */ /* These functions can use static numbers or result sets(col parameter) */
Int4 pgtype_precision(StatementClass *stmt, Int4 type, int col, int handle_unknown_size_as); Int4 pgtype_column_size(StatementClass *stmt, Int4 type, int col, int handle_unknown_size_as); /* corresponds to "precision" in ODBC 2.x */
Int4 pgtype_precision(StatementClass *stmt, Int4 type, int col, int handle_unknown_size_as); /* "precsion in ODBC 3.x */
Int4 pgtype_display_size(StatementClass *stmt, Int4 type, int col, int handle_unknown_size_as); Int4 pgtype_display_size(StatementClass *stmt, Int4 type, int col, int handle_unknown_size_as);
Int4 pgtype_length(StatementClass *stmt, Int4 type, int col, int handle_unknown_size_as); Int4 pgtype_buffer_length(StatementClass *stmt, Int4 type, int col, int handle_unknown_size_as);
Int4 pgtype_desclength(StatementClass *stmt, Int4 type, int col, int handle_unknown_size_as);
Int4 pgtype_transfer_octet_length(StatementClass *stmt, Int4 type, int col, int handle_unknown_size_as);
Int2 pgtype_scale(StatementClass *stmt, Int4 type, int col); Int2 pgtype_decimal_digits(StatementClass *stmt, Int4 type, int col); /* corresponds to "scale" in ODBC 2.x */
Int2 pgtype_scale(StatementClass *stmt, Int4 type, int col); /* ODBC 3.x " */
Int2 pgtype_radix(StatementClass *stmt, Int4 type); Int2 pgtype_radix(StatementClass *stmt, Int4 type);
Int2 pgtype_nullable(StatementClass *stmt, Int4 type); Int2 pgtype_nullable(StatementClass *stmt, Int4 type);
Int2 pgtype_auto_increment(StatementClass *stmt, Int4 type); Int2 pgtype_auto_increment(StatementClass *stmt, Int4 type);
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* *
* Comments: See "notice.txt" for copyright and license information. * Comments: See "notice.txt" for copyright and license information.
* *
* $Id: psqlodbc.h,v 1.60 2002/03/14 05:42:03 inoue Exp $ * $Id: psqlodbc.h,v 1.61 2002/03/28 08:08:06 inoue Exp $
* *
*/ */
...@@ -91,7 +91,11 @@ typedef UInt4 Oid; ...@@ -91,7 +91,11 @@ typedef UInt4 Oid;
#ifdef WIN32 #ifdef WIN32
#if (ODBCVER >= 0x0300) #if (ODBCVER >= 0x0300)
#ifdef UNICODE_SUPPORT
#define DRIVER_FILE_NAME "PSQLODBC30W.DLL"
#else
#define DRIVER_FILE_NAME "PSQLODBC30.DLL" #define DRIVER_FILE_NAME "PSQLODBC30.DLL"
#endif /* UNICODE_SUPPORT */
#else #else
#define DRIVER_FILE_NAME "PSQLODBC.DLL" #define DRIVER_FILE_NAME "PSQLODBC.DLL"
#endif /* ODBCVER */ #endif /* ODBCVER */
...@@ -167,6 +171,11 @@ typedef struct EnvironmentClass_ EnvironmentClass; ...@@ -167,6 +171,11 @@ typedef struct EnvironmentClass_ EnvironmentClass;
typedef struct TupleNode_ TupleNode; typedef struct TupleNode_ TupleNode;
typedef struct TupleField_ TupleField; typedef struct TupleField_ TupleField;
typedef struct KeySet_ KeySet; typedef struct KeySet_ KeySet;
typedef struct Rollback_ Rollback;
typedef struct ARDFields_ ARDFields;
typedef struct APDFields_ APDFields;
typedef struct IRDFields_ IRDFields;
typedef struct IPDFields_ IPDFields;
typedef struct col_info COL_INFO; typedef struct col_info COL_INFO;
typedef struct lo_arg LO_ARG; typedef struct lo_arg LO_ARG;
...@@ -201,25 +210,12 @@ typedef struct StatementOptions_ ...@@ -201,25 +210,12 @@ typedef struct StatementOptions_
{ {
int maxRows; int maxRows;
int maxLength; int maxLength;
int rowset_size;
int keyset_size; int keyset_size;
int cursor_type; int cursor_type;
int scroll_concurrency; int scroll_concurrency;
int retrieve_data; int retrieve_data;
int bind_size; /* size of each structure if using Row
* Binding */
int use_bookmarks; int use_bookmarks;
UInt4 *rowsFetched; void *bookmark_ptr;
UInt2 *rowStatusArray;
void *bookmark_ptr;
UInt2 *row_operation_ptr;
UInt4 *row_offset_ptr;
UInt4 paramset_size;
UInt4 param_bind_type;
UInt4 *param_processed_ptr;
UInt2 *param_status_ptr;
UInt2 *param_operation_ptr;
UInt4 *param_offset_ptr;
} StatementOptions; } StatementOptions;
/* Used to pass extra query info to send_query */ /* Used to pass extra query info to send_query */
...@@ -260,6 +256,7 @@ UInt4 ucs2strlen(const SQLWCHAR *ucs2str); ...@@ -260,6 +256,7 @@ UInt4 ucs2strlen(const SQLWCHAR *ucs2str);
char *ucs2_to_utf8(const SQLWCHAR *ucs2str, Int4 ilen, UInt4 *olen); char *ucs2_to_utf8(const SQLWCHAR *ucs2str, Int4 ilen, UInt4 *olen);
UInt4 utf8_to_ucs2(const char * utf8str, Int4 ilen, SQLWCHAR *ucs2str, UInt4 buflen); UInt4 utf8_to_ucs2(const char * utf8str, Int4 ilen, SQLWCHAR *ucs2str, UInt4 buflen);
#endif /* UNICODE_SUPPORT */ #endif /* UNICODE_SUPPORT */
/*#define _MEMORY_DEBUG_ */
#ifdef _MEMORY_DEBUG_ #ifdef _MEMORY_DEBUG_
void *debug_alloc(size_t); void *debug_alloc(size_t);
void *debug_realloc(void *, size_t); void *debug_realloc(void *, size_t);
......
...@@ -138,7 +138,7 @@ BEGIN ...@@ -138,7 +138,7 @@ BEGIN
BS_NOTIFY | WS_TABSTOP,247,205,40,10 BS_NOTIFY | WS_TABSTOP,247,205,40,10
END END
DLG_OPTIONS_DS DIALOG DISCARDABLE 0, 0, 267, 176 DLG_OPTIONS_DS DIALOG DISCARDABLE 0, 0, 267, 196
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Advanced Options (DataSource)" CAPTION "Advanced Options (DataSource)"
FONT 10, "Terminal" FONT 10, "Terminal"
...@@ -155,23 +155,25 @@ BEGIN ...@@ -155,23 +155,25 @@ BEGIN
BS_AUTOCHECKBOX | WS_TABSTOP,45,43,92,10 BS_AUTOCHECKBOX | WS_TABSTOP,45,43,92,10
CONTROL "True is -1",DS_TRUEISMINUS1,"Button", CONTROL "True is -1",DS_TRUEISMINUS1,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,149,43,86,10 BS_AUTOCHECKBOX | WS_TABSTOP,149,43,86,10
GROUPBOX "Protocol",IDC_STATIC,43,59,180,25 CONTROL "(Trial) Updatable cursors",DS_UPDATABLECURSORS,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,45,58,112,10
GROUPBOX "Protocol",IDC_STATIC,43,74,180,25
CONTROL "7.X,6.4+",DS_PG64,"Button",BS_AUTORADIOBUTTON | CONTROL "7.X,6.4+",DS_PG64,"Button",BS_AUTORADIOBUTTON |
WS_GROUP,53,69,47,10 WS_GROUP,53,84,47,10
CONTROL "6.3",DS_PG63,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP, CONTROL "6.3",DS_PG63,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,
131,69,26,10 131,84,26,10
CONTROL "6.2",DS_PG62,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP, CONTROL "6.2",DS_PG62,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,
187,69,26,10 187,84,26,10
GROUPBOX "OID Options",IDC_STATIC,43,89,180,25 GROUPBOX "OID Options",IDC_STATIC,43,104,180,25
CONTROL "Show &Column",DS_SHOWOIDCOLUMN,"Button",BS_AUTOCHECKBOX | CONTROL "Show &Column",DS_SHOWOIDCOLUMN,"Button",BS_AUTOCHECKBOX |
WS_GROUP | WS_TABSTOP,53,100,59,10 WS_GROUP | WS_TABSTOP,53,115,59,10
CONTROL "Fake &Index",DS_FAKEOIDINDEX,"Button",BS_AUTOCHECKBOX | CONTROL "Fake &Index",DS_FAKEOIDINDEX,"Button",BS_AUTOCHECKBOX |
WS_GROUP | WS_TABSTOP,161,100,55,10 WS_GROUP | WS_TABSTOP,161,115,55,10
LTEXT "Connect &Settings:",IDC_STATIC,10,120,35,25 LTEXT "Connect &Settings:",IDC_STATIC,10,135,35,25
EDITTEXT DS_CONNSETTINGS,50,120,200,20,ES_MULTILINE | EDITTEXT DS_CONNSETTINGS,50,135,200,20,ES_MULTILINE |
ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN
DEFPUSHBUTTON "OK",IDOK,71,150,50,14,WS_GROUP DEFPUSHBUTTON "OK",IDOK,71,165,50,14,WS_GROUP
PUSHBUTTON "Cancel",IDCANCEL,146,150,50,14 PUSHBUTTON "Cancel",IDCANCEL,146,165,50,14
END END
#else #else
DLG_CONFIG DIALOG DISCARDABLE 65, 43, 292, 116 DLG_CONFIG DIALOG DISCARDABLE 65, 43, 292, 116
...@@ -259,7 +261,7 @@ BEGIN ...@@ -259,7 +261,7 @@ BEGIN
BS_NOTIFY | WS_TABSTOP,233,224,40,10 BS_NOTIFY | WS_TABSTOP,233,224,40,10
END END
DLG_OPTIONS_DS DIALOG DISCARDABLE 0, 0, 267, 176 DLG_OPTIONS_DS DIALOG DISCARDABLE 0, 0, 267, 186
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Advanced Options (DataSource)" CAPTION "Advanced Options (DataSource)"
FONT 8, "MS Sans Serif" FONT 8, "MS Sans Serif"
...@@ -273,26 +275,28 @@ BEGIN ...@@ -273,26 +275,28 @@ BEGIN
CONTROL "Disallow &Premature",DS_DISALLOWPREMATURE,"Button", CONTROL "Disallow &Premature",DS_DISALLOWPREMATURE,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,130,25,85,10 BS_AUTOCHECKBOX | WS_TABSTOP,130,25,85,10
CONTROL "LF <-> CR/LF convert",DS_LFCONVERSION,"Button", CONTROL "LF <-> CR/LF convert",DS_LFCONVERSION,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,45,40,92,10 BS_AUTOCHECKBOX | WS_TABSTOP,25,40,92,10
CONTROL "True is -1",DS_TRUEISMINUS1,"Button", CONTROL "True is -1",DS_TRUEISMINUS1,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,149,40,86,10 BS_AUTOCHECKBOX | WS_TABSTOP,130,40,86,10
GROUPBOX "Protocol",IDC_STATIC,15,55,180,25 CONTROL "(Trial) Updatable Cursors",DS_UPDATABLECURSORS,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,25,55,102,10
GROUPBOX "Protocol",IDC_STATIC,15,70,180,25
CONTROL "7.X,6.4+",DS_PG64,"Button",BS_AUTORADIOBUTTON | WS_GROUP,25, CONTROL "7.X,6.4+",DS_PG64,"Button",BS_AUTORADIOBUTTON | WS_GROUP,25,
65,35,10 80,35,10
CONTROL "6.3",DS_PG63,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP, CONTROL "6.3",DS_PG63,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,
75,65,26,10 75,80,26,10
CONTROL "6.2",DS_PG62,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP, CONTROL "6.2",DS_PG62,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,
130,65,26,10 130,80,26,10
GROUPBOX "OID Options",IDC_STATIC,15,86,180,25 GROUPBOX "OID Options",IDC_STATIC,15,101,180,25
CONTROL "Show &Column",DS_SHOWOIDCOLUMN,"Button",BS_AUTOCHECKBOX | CONTROL "Show &Column",DS_SHOWOIDCOLUMN,"Button",BS_AUTOCHECKBOX |
WS_GROUP | WS_TABSTOP,25,96,59,10 WS_GROUP | WS_TABSTOP,25,111,59,10
CONTROL "Fake &Index",DS_FAKEOIDINDEX,"Button",BS_AUTOCHECKBOX | CONTROL "Fake &Index",DS_FAKEOIDINDEX,"Button",BS_AUTOCHECKBOX |
WS_GROUP | WS_TABSTOP,115,96,51,10 WS_GROUP | WS_TABSTOP,115,111,51,10
RTEXT "Connect &Settings:",IDC_STATIC,10,120,35,25 RTEXT "Connect &Settings:",IDC_STATIC,10,135,35,25
EDITTEXT DS_CONNSETTINGS,50,120,200,20,ES_MULTILINE | EDITTEXT DS_CONNSETTINGS,50,135,200,20,ES_MULTILINE |
ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_WANTRETURN
DEFPUSHBUTTON "OK",IDOK,71,150,50,14,WS_GROUP DEFPUSHBUTTON "OK",IDOK,71,165,50,14,WS_GROUP
PUSHBUTTON "Cancel",IDCANCEL,146,150,50,14 PUSHBUTTON "Cancel",IDCANCEL,146,165,50,14
END END
#endif #endif
......
REGEDIT4
[HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI]
[HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers]
"PostgreSQL30W"="Installed"
[HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\PostgreSQL30W]
"APILevel"="1"
"ConnectFunctions"="YYN"
"Driver"="PSQLODBC30W.DLL"
"DriverODBCVer"="03.00"
"FileUsage"="0"
"Setup"="PSQLODBC30W.DLL"
"SQLLevel"="1"
"UsageCount"=dword:00000001
...@@ -74,9 +74,9 @@ SQLSetDescField @96 ...@@ -74,9 +74,9 @@ SQLSetDescField @96
SQLSetDescRec @97 SQLSetDescRec @97
SQLSetEnvAttr @98 SQLSetEnvAttr @98
SQLSetStmtAttr @99 SQLSetStmtAttr @99
SQLBulkOperations @100
SQLDummyOrdinal @199 SQLDummyOrdinal @199
dconn_FDriverConnectProc @200 dconn_FDriverConnectProc @200
DllMain @201 DllMain @201
ConfigDSN @202 ConfigDSN @202
LIBRARY psqlodbc30 LIBRARY psqlodbc30w
EXPORTS EXPORTS
SQLAllocConnect @1 SQLAllocConnect @1
SQLAllocEnv @2 SQLAllocEnv @2
...@@ -71,6 +71,7 @@ SQLSetDescField @96 ...@@ -71,6 +71,7 @@ SQLSetDescField @96
SQLSetDescRec @97 SQLSetDescRec @97
SQLSetEnvAttr @98 SQLSetEnvAttr @98
SQLSetStmtAttr @99 SQLSetStmtAttr @99
SQLBulkOperations @100
SQLDummyOrdinal @199 SQLDummyOrdinal @199
dconn_FDriverConnectProc @200 dconn_FDriverConnectProc @200
......
This diff is collapsed.
...@@ -73,8 +73,9 @@ struct QResultClass_ ...@@ -73,8 +73,9 @@ struct QResultClass_
* progress? */ * progress? */
char aborted; /* was aborted? */ char aborted; /* was aborted? */
char haskeyset; /* this result contains keyset ? */ char haskeyset; /* this result contains keyset ? */
KeySet *keyset; KeySet *keyset;
UInt4 rb_count; /* count of rollback info */
Rollback *rollback;
}; };
#define QR_get_fields(self) (self->fields) #define QR_get_fields(self) (self->fields)
......
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
#define DS_DISALLOWPREMATURE 1061 #define DS_DISALLOWPREMATURE 1061
#define DS_LFCONVERSION 1062 #define DS_LFCONVERSION 1062
#define DS_TRUEISMINUS1 1063 #define DS_TRUEISMINUS1 1063
#define DS_UPDATABLECURSORS 1064
/* Next default values for new objects */ /* Next default values for new objects */
/* */ /* */
...@@ -61,7 +62,7 @@ ...@@ -61,7 +62,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS #ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 105 #define _APS_NEXT_RESOURCE_VALUE 105
#define _APS_NEXT_COMMAND_VALUE 40001 #define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1062 #define _APS_NEXT_CONTROL_VALUE 1065
#define _APS_NEXT_SYMED_VALUE 101 #define _APS_NEXT_SYMED_VALUE 101
#endif /* */ #endif /* */
......
This diff is collapsed.
...@@ -56,7 +56,7 @@ typedef struct tagSETUPDLG ...@@ -56,7 +56,7 @@ typedef struct tagSETUPDLG
/* Prototypes */ /* Prototypes */
void INTFUNC CenterDialog(HWND hdlg); void INTFUNC CenterDialog(HWND hdlg);
int CALLBACK ConfigDlgProc(HWND hdlg, WORD wMsg, WPARAM wParam, LPARAM lParam); int CALLBACK ConfigDlgProc(HWND hdlg, UINT wMsg, WPARAM wParam, LPARAM lParam);
void INTFUNC ParseAttributes(LPCSTR lpszAttributes, LPSETUPDLG lpsetupdlg); void INTFUNC ParseAttributes(LPCSTR lpszAttributes, LPSETUPDLG lpsetupdlg);
BOOL INTFUNC SetDSNAttributes(HWND hwnd, LPSETUPDLG lpsetupdlg); BOOL INTFUNC SetDSNAttributes(HWND hwnd, LPSETUPDLG lpsetupdlg);
...@@ -211,7 +211,7 @@ CenterDialog(HWND hdlg) ...@@ -211,7 +211,7 @@ CenterDialog(HWND hdlg)
*/ */
int CALLBACK int CALLBACK
ConfigDlgProc(HWND hdlg, ConfigDlgProc(HWND hdlg,
WORD wMsg, UINT wMsg,
WPARAM wParam, WPARAM wParam,
LPARAM lParam) LPARAM lParam)
{ {
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -96,9 +96,9 @@ CLEAN : ...@@ -96,9 +96,9 @@ CLEAN :
CPP=cl.exe CPP=cl.exe
!IF "$(CFG)" == "MultibyteRelease" !IF "$(CFG)" == "MultibyteRelease"
CPP_PROJ=/nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PSQLODBC_EXPORTS" /D "MULTIBYTE" /Fp"$(INTDIR)\psqlodbc.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c CPP_PROJ=/nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PSQLODBC_EXPORTS" /D "MULTIBYTE" /D "DRIVER_CURSOR_IMPLEMENT" /Fp"$(INTDIR)\psqlodbc.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
!ELSE !ELSE
CPP_PROJ=/nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PSQLODBC_EXPORTS" /Fp"$(INTDIR)\psqlodbc.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c CPP_PROJ=/nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "PSQLODBC_EXPORTS" /D "DRIVER_CURSOR_IMPLEMENT" /Fp"$(INTDIR)\psqlodbc.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
!ENDIF !ENDIF
.c{$(INTDIR)}.obj:: .c{$(INTDIR)}.obj::
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment