Commit bf1f2e54 authored by Hiroshi Inoue's avatar Hiroshi Inoue

1) Fix SQLProcedures().

2) Handle timestamp without time zone.
3) Improve SQLForeignKeys() in multibyte mode.
parent 0c1fe3d2
......@@ -384,7 +384,7 @@ CC_begin(ConnectionClass *self)
if (res != NULL)
{
ret = QR_command_successful(res);
ret = QR_command_maybe_successful(res);
QR_Destructor(res);
}
else
......@@ -408,7 +408,7 @@ CC_commit(ConnectionClass *self)
mylog("CC_commit: sending COMMIT!\n");
if (res != NULL)
{
ret = QR_command_successful(res);
ret = QR_command_maybe_successful(res);
QR_Destructor(res);
}
else
......
......@@ -169,6 +169,7 @@ timestamp2stime(const char *str, SIMPLE_TIME *st, BOOL *bZone, int *zone)
*bZone = FALSE;
*zone = 0;
st->fr = 0;
st->infinity = 0;
if ((scnt = sscanf(str, "%4d-%2d-%2d %2d:%2d:%2d%s", &st->y, &st->m, &st->d, &st->hh, &st->mm, &st->ss, rest)) < 6)
return FALSE;
else if (scnt == 6)
......@@ -455,6 +456,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
case PG_TYPE_ABSTIME:
case PG_TYPE_DATETIME:
case PG_TYPE_TIMESTAMP_NO_TMZONE:
case PG_TYPE_TIMESTAMP:
st.fr = 0;
st.infinity = 0;
......@@ -464,9 +466,9 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
st.m = 12;
st.d = 31;
st.y = 9999;
st.hh = 24;
st.mm = 0;
st.ss = 0;
st.hh = 23;
st.mm = 59;
st.ss = 59;
}
if (strnicmp(value, "-infinity", 9) == 0)
{
......@@ -641,6 +643,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
case PG_TYPE_ABSTIME:
case PG_TYPE_DATETIME:
case PG_TYPE_TIMESTAMP_NO_TMZONE:
case PG_TYPE_TIMESTAMP:
len = 19;
if (cbValueMax > len)
......@@ -1810,7 +1813,7 @@ copy_statement_with_parameters(StatementClass *stmt)
st.ss = tss->second;
st.fr = tss->fraction;
mylog("m=%d,d=%d,y=%d,hh=%d,mm=%d,ss=%d\n", st.m, st.d, st.y, st.hh, st.mm, st.ss);
mylog("m=%d,d=%d,y=%d,hh=%d,mm=%d,ss=%d,fr=%d\n", st.m, st.d, st.y, st.hh, st.mm, st.ss, st.fr);
break;
......
......@@ -553,7 +553,7 @@ PGAPI_Transact(
return SQL_ERROR;
}
ok = QR_command_successful(res);
ok = QR_command_maybe_successful(res);
QR_Destructor(res);
if (!ok)
......
This diff is collapsed.
......@@ -55,6 +55,7 @@ Int4 pgtypes_defined[] = {
PG_TYPE_TIME_WITH_TMZONE,
PG_TYPE_DATETIME,
PG_TYPE_ABSTIME,
PG_TYPE_TIMESTAMP_NO_TMZONE,
PG_TYPE_TIMESTAMP,
PG_TYPE_TEXT,
PG_TYPE_INT2,
......@@ -312,6 +313,7 @@ pgtype_to_concise_type(StatementClass *stmt, Int4 type)
return SQL_TIME;
case PG_TYPE_ABSTIME:
case PG_TYPE_DATETIME:
case PG_TYPE_TIMESTAMP_NO_TMZONE:
case PG_TYPE_TIMESTAMP:
#if (ODBCVER >= 0x0300)
if (EN_is_odbc3(env))
......@@ -416,6 +418,7 @@ pgtype_to_ctype(StatementClass *stmt, Int4 type)
return SQL_C_TIME;
case PG_TYPE_ABSTIME:
case PG_TYPE_DATETIME:
case PG_TYPE_TIMESTAMP_NO_TMZONE:
case PG_TYPE_TIMESTAMP:
#if (ODBCVER >= 0x0300)
if (EN_is_odbc3(env))
......@@ -491,6 +494,8 @@ pgtype_to_name(StatementClass *stmt, Int4 type)
return "abstime";
case PG_TYPE_DATETIME:
return "datetime";
case PG_TYPE_TIMESTAMP_NO_TMZONE:
return "timestamp_nozone";
case PG_TYPE_TIMESTAMP:
return "timestamp";
case PG_TYPE_MONEY:
......@@ -817,6 +822,7 @@ pgtype_column_size(StatementClass *stmt, Int4 type, int col, int handle_unknown_
case PG_TYPE_TIMESTAMP:
return 22;
case PG_TYPE_DATETIME:
case PG_TYPE_TIMESTAMP_NO_TMZONE:
/* return 22; */
return getTimestampColumnSize(stmt, type, col);
......@@ -851,6 +857,7 @@ pgtype_precision(StatementClass *stmt, Int4 type, int col, int handle_unknown_si
case PG_TYPE_NUMERIC:
return getNumericColumnSize(stmt, type, col);
case PG_TYPE_DATETIME:
case PG_TYPE_TIMESTAMP_NO_TMZONE:
return getTimestampDecimalDigits(stmt, type, col);
}
return -1;
......@@ -938,6 +945,7 @@ pgtype_buffer_length(StatementClass *stmt, Int4 type, int col, int handle_unknow
case PG_TYPE_ABSTIME:
case PG_TYPE_DATETIME:
case PG_TYPE_TIMESTAMP:
case PG_TYPE_TIMESTAMP_NO_TMZONE:
return 16; /* sizeof(TIMESTAMP_STRUCT) */
/* Character types use the default precision */
......@@ -1001,6 +1009,7 @@ pgtype_desclength(StatementClass *stmt, Int4 type, int col, int handle_unknown_s
case PG_TYPE_TIME:
case PG_TYPE_ABSTIME:
case PG_TYPE_DATETIME:
case PG_TYPE_TIMESTAMP_NO_TMZONE:
case PG_TYPE_TIMESTAMP:
case PG_TYPE_VARCHAR:
case PG_TYPE_BPCHAR:
......@@ -1073,6 +1082,7 @@ pgtype_decimal_digits(StatementClass *stmt, Int4 type, int col)
case PG_TYPE_TIMESTAMP:
return 0;
case PG_TYPE_DATETIME:
case PG_TYPE_TIMESTAMP_NO_TMZONE:
/* return 0; */
return getTimestampDecimalDigits(stmt, type, col);
......@@ -1147,6 +1157,7 @@ pgtype_auto_increment(StatementClass *stmt, Int4 type)
case PG_TYPE_TIME:
case PG_TYPE_ABSTIME:
case PG_TYPE_DATETIME:
case PG_TYPE_TIMESTAMP_NO_TMZONE:
case PG_TYPE_TIMESTAMP:
return FALSE;
......
......@@ -1964,7 +1964,7 @@ SC_pos_delete(StatementClass *stmt,
mylog("dltstr=%s\n", dltstr);
qres = CC_send_query(conn, dltstr, NULL, CLEAR_RESULT_ON_ABORT);
ret = SQL_SUCCESS;
if (qres && QR_command_successful(qres))
if (qres && QR_command_maybe_successful(qres))
{
int dltcnt;
const char *cmdstr = QR_get_command(qres);
......
......@@ -955,7 +955,7 @@ SC_execute(StatementClass *self)
/* send the declare/select */
res = CC_send_query(conn, self->stmt_with_params, NULL, qflag);
if (SC_is_fetchcursor(self) && res != NULL &&
QR_command_successful(res))
QR_command_maybe_successful(res))
{
QR_Destructor(res);
qflag &= (~ GO_INTO_TRANSACTION);
......
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