diff options
author | Byron Nikolaidis <byronn@insightdist.com> | 1999-01-08 18:24:45 +0000 |
---|---|---|
committer | Byron Nikolaidis <byronn@insightdist.com> | 1999-01-08 18:24:45 +0000 |
commit | 0b644ad332f5c9cfb074c41462e6274b72c39d5d (patch) | |
tree | d1066d3d46ed58468432f85b920182cca38cf555 /src/interfaces/odbc/statement.c | |
parent | 97b88f1c1599b029e67e4686029c0ad4b8281b33 (diff) | |
download | postgresql-0b644ad332f5c9cfb074c41462e6274b72c39d5d.tar.gz postgresql-0b644ad332f5c9cfb074c41462e6274b72c39d5d.zip |
Update 06-40-0004 -- Add Bookmark support!
Diffstat (limited to 'src/interfaces/odbc/statement.c')
-rw-r--r-- | src/interfaces/odbc/statement.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/interfaces/odbc/statement.c b/src/interfaces/odbc/statement.c index 86bce41a8f9..e8a8b17b36d 100644 --- a/src/interfaces/odbc/statement.c +++ b/src/interfaces/odbc/statement.c @@ -185,6 +185,7 @@ InitializeStatementOptions(StatementOptions *opt) opt->cursor_type = SQL_CURSOR_FORWARD_ONLY; opt->bind_size = 0; /* default is to bind by column */ opt->retrieve_data = SQL_RD_ON; + opt->use_bookmarks = SQL_UB_OFF; } StatementClass * @@ -213,6 +214,9 @@ StatementClass *rv; rv->bindings = NULL; rv->bindings_allocated = 0; + rv->bookmark.buffer = NULL; + rv->bookmark.used = NULL; + rv->parameters_allocated = 0; rv->parameters = 0; @@ -496,6 +500,9 @@ Int2 lf; self->bindings[lf].returntype = SQL_C_CHAR; } + self->bookmark.buffer = NULL; + self->bookmark.used = NULL; + return 1; } @@ -566,6 +573,15 @@ char rv; return rv; } +/* Currently, the driver offers very simple bookmark support -- it is + just the current row number. But it could be more sophisticated + someday, such as mapping a key to a 32 bit value +*/ +unsigned long +SC_get_bookmark(StatementClass *self) +{ + return (self->currTuple + 1); +} RETCODE SC_fetch(StatementClass *self) @@ -624,6 +640,19 @@ ColumnInfoClass *ci; result = SQL_SUCCESS; self->last_fetch_count = 1; + /* If the bookmark column was bound then return a bookmark. + Since this is used with SQLExtendedFetch, and the rowset size + may be greater than 1, and an application can use row or column wise + binding, use the code in copy_and_convert_field() to handle that. + */ + if (self->bookmark.buffer) { + char buf[32]; + + sprintf(buf, "%ld", SC_get_bookmark(self)); + result = copy_and_convert_field(self, 0, buf, + SQL_C_ULONG, self->bookmark.buffer, 0, self->bookmark.used); + } + for (lf=0; lf < num_cols; lf++) { mylog("fetch: cols=%d, lf=%d, self = %u, self->bindings = %u, buffer[] = %u\n", num_cols, lf, self, self->bindings, self->bindings[lf].buffer); |