16 #if ENABLE_EXTRA_CHECKS
22 if (
buf->capacity == 0 ||
buf->capacity == 1) {
36 if (
buf->tail ==
buf->capacity) {
38 for (
i = 0;
buf->rows &&
i <
buf->capacity; ++
i) {
53 assert(
i >= 0 && i < buf->capacity);
58 if (
i ==
buf->capacity)
60 }
while (
i !=
buf->head);
63 if (
buf->head !=
buf->tail) {
66 assert(
i >= 0 && i < buf->capacity);
72 if (
i ==
buf->capacity)
74 }
while (
i !=
buf->tail);
77 #define BUFFER_CHECK(buf) buffer_check(buf)
79 #define BUFFER_CHECK(buf) do {} while(0)
114 return (
buf->head >
buf->tail) ?
134 if (
buf->tail <=
buf->head)
135 if (
buf->head <= idx && idx <= buf->tail)
138 if (0 <= idx && idx <= buf->
head)
141 if (
buf->tail <= idx && idx < buf->capacity)
181 for (
i = 0;
i <
buf->capacity; ++
i)
196 buf->current =
buf->tail =
buf->capacity;
203 if (++idx >=
buf->capacity) {
217 if (idx < 0 || idx >=
buf->capacity) {
223 return &(
buf->rows[idx]);
248 if (
i ==
buf->capacity) {
264 }
while (
i !=
buf->head);
283 for (
i=0;
i < count;
i++) {
284 if (
buf->tail <
buf->capacity)
291 if (
buf->tail ==
buf->head) {
407 if (
buf->capacity <= 1)
409 if (
buf->current ==
buf->head ||
buf->current ==
buf->capacity)
415 if(
buf->tail <
buf->head) {
419 if (
buf->current >
buf->head)
446 buf->capacity = nrows;
501 row->
row = ++
buf->received;
530 int idx =
buf->head - 1;
532 if (
buf->capacity <= 1)
536 idx =
buf->capacity - 1;
537 if (idx >= 0 && idx < buf->capacity) {
538 row = &
buf->rows[idx];
static void buffer_alloc(DBPROCESS *dbproc)
static void buffer_delete_rows(DBPROC_ROWBUF *buf, int count)
Deleting a row from the buffer doesn't affect memory allocation.
static int buffer_is_full(const DBPROC_ROWBUF *buf)
Can the buffer be written to?
static int buffer_count(const DBPROC_ROWBUF *buf)
A few words on the buffering design.
static DBINT buffer_idx2row(const DBPROC_ROWBUF *buf, int idx)
Convert an index to a row number.
static void buffer_set_capacity(DBPROCESS *dbproc, int nrows)
static int buffer_index_valid(const DBPROC_ROWBUF *buf, int idx)
static DBLIB_BUFFER_ROW * buffer_row_address(const DBPROC_ROWBUF *buf, int idx)
Given an index, return the row storage, including the DBINT row number prefix.
static int buffer_add_row(DBPROCESS *dbproc, TDSRESULTINFO *resinfo)
Called by dbnextrow Returns a row buffer index, or -1 to indicate the buffer is full.
#define BUFFER_CHECK(buf)
static void buffer_free(DBPROC_ROWBUF *buf)
static void buffer_transfer_bound_data(DBPROC_ROWBUF *buf, TDS_INT res_type, TDS_INT compute_id, DBPROCESS *dbproc, int idx)
static void buffer_reset(DBPROC_ROWBUF *buf)
static int buffer_row2idx(const DBPROC_ROWBUF *buf, int row_number)
Convert a row number to an index.
struct dblib_buffer_row DBLIB_BUFFER_ROW
static RETCODE buffer_save_row(DBPROCESS *dbproc)
static void buffer_struct_print(const DBPROC_ROWBUF *buf)
static int buffer_current_index(const DBPROCESS *dbproc)
Return the current row buffer index.
static int buffer_idx_increment(const DBPROC_ROWBUF *buf, int idx)
static void buffer_free_row(DBLIB_BUFFER_ROW *row)
if(yy_accept[yy_current_state])
#define copy_data_to_host_var
#define tds_get_conversion_type
unsigned char * row_data
row data, NULL for resinfo->current_row
TDS_INT * sizes
save old sizes
TDSRESULTINFO * resinfo
pointer to result informations
Information about blobs (e.g.
Metadata about columns in regular and compute rows.
TDS_SMALLINT * column_nullbind
TDS_INT column_size
maximun size of data.
TDS_SMALLINT column_bindtype
unsigned char * column_data
TDS_SERVER_TYPE column_type
This type can be different from wire type because conversion (e.g.
TDS_CHAR * column_varaddr
TDS_INT column_cur_size
size written in variable (ie: char, text, binary).
Hold information for any results.
unsigned char * current_row
tds_sysdep_int32_type TDS_INT
#define tds_new0(type, n)