Skip to content

Commit bf1f2e5

Browse files
author
Hiroshi Inoue
committed
1) Fix SQLProcedures().
2) Handle timestamp without time zone. 3) Improve SQLForeignKeys() in multibyte mode.
1 parent 0c1fe3d commit bf1f2e5

File tree

7 files changed

+317
-160
lines changed

7 files changed

+317
-160
lines changed

src/interfaces/odbc/connection.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ CC_begin(ConnectionClass *self)
384384

385385
if (res != NULL)
386386
{
387-
ret = QR_command_successful(res);
387+
ret = QR_command_maybe_successful(res);
388388
QR_Destructor(res);
389389
}
390390
else
@@ -408,7 +408,7 @@ CC_commit(ConnectionClass *self)
408408
mylog("CC_commit: sending COMMIT!\n");
409409
if (res != NULL)
410410
{
411-
ret = QR_command_successful(res);
411+
ret = QR_command_maybe_successful(res);
412412
QR_Destructor(res);
413413
}
414414
else

src/interfaces/odbc/convert.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,7 @@ timestamp2stime(const char *str, SIMPLE_TIME *st, BOOL *bZone, int *zone)
169169
*bZone = FALSE;
170170
*zone = 0;
171171
st->fr = 0;
172+
st->infinity = 0;
172173
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)
173174
return FALSE;
174175
else if (scnt == 6)
@@ -455,6 +456,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
455456

456457
case PG_TYPE_ABSTIME:
457458
case PG_TYPE_DATETIME:
459+
case PG_TYPE_TIMESTAMP_NO_TMZONE:
458460
case PG_TYPE_TIMESTAMP:
459461
st.fr = 0;
460462
st.infinity = 0;
@@ -464,9 +466,9 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
464466
st.m = 12;
465467
st.d = 31;
466468
st.y = 9999;
467-
st.hh = 24;
468-
st.mm = 0;
469-
st.ss = 0;
469+
st.hh = 23;
470+
st.mm = 59;
471+
st.ss = 59;
470472
}
471473
if (strnicmp(value, "-infinity", 9) == 0)
472474
{
@@ -641,6 +643,7 @@ copy_and_convert_field(StatementClass *stmt, Int4 field_type, void *value, Int2
641643

642644
case PG_TYPE_ABSTIME:
643645
case PG_TYPE_DATETIME:
646+
case PG_TYPE_TIMESTAMP_NO_TMZONE:
644647
case PG_TYPE_TIMESTAMP:
645648
len = 19;
646649
if (cbValueMax > len)
@@ -1810,7 +1813,7 @@ copy_statement_with_parameters(StatementClass *stmt)
18101813
st.ss = tss->second;
18111814
st.fr = tss->fraction;
18121815

1813-
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);
1816+
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);
18141817

18151818
break;
18161819

src/interfaces/odbc/execute.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ PGAPI_Transact(
553553
return SQL_ERROR;
554554
}
555555

556-
ok = QR_command_successful(res);
556+
ok = QR_command_maybe_successful(res);
557557
QR_Destructor(res);
558558

559559
if (!ok)

0 commit comments

Comments
 (0)