summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d09fef3)
raw | patch | inline | side by side (parent: d09fef3)
author | Sebastian Harl <sh@tokkee.org> | |
Wed, 4 Sep 2013 08:48:29 +0000 (10:48 +0200) | ||
committer | Sebastian Harl <sh@tokkee.org> | |
Wed, 4 Sep 2013 08:48:29 +0000 (10:48 +0200) |
t/utils/dbi_test.c | patch | blob | history |
diff --git a/t/utils/dbi_test.c b/t/utils/dbi_test.c
index e32f005f179146d6b4d3f437dc0a33d9d466386c..59cd46bf4b9ad8f0b50ecfea9f2c4810d21be991 100644 (file)
--- a/t/utils/dbi_test.c
+++ b/t/utils/dbi_test.c
fail_unless(i && i <= q->nfields,
"dbi_result_get_*_idx() called with index out of range; "
"got: %u; expected [1, %u]", i, q->nfields);
- return golden_data[q->current_row - 1][i];
+ return golden_data[q->current_row - 1][i - 1];
} /* get_golden_data */
long long
dbi_result_get_longlong_idx(dbi_result res, unsigned int i)
{
- fail_unless(current_query->field_types[i] != DBI_TYPE_INTEGER,
+ fail_unless(current_query->field_types[i - 1] == DBI_TYPE_INTEGER,
"dbi_result_get_longlong_idx() called for non-integer "
- "column type %u", current_query->field_types[i]);
+ "column type %u", current_query->field_types[i - 1]);
return get_golden_data(res, i).integer;
} /* dbi_result_get_longlong_idx */
double
dbi_result_get_double_idx(dbi_result res, unsigned int i)
{
- fail_unless(current_query->field_types[i] != DBI_TYPE_DECIMAL,
- "dbi_result_get_double_idx() called for non-integer "
- "column type %u", current_query->field_types[i]);
+ fail_unless(current_query->field_types[i - 1] == DBI_TYPE_DECIMAL,
+ "dbi_result_get_double_idx() called for non-decimal "
+ "column type %u", current_query->field_types[i - 1]);
return get_golden_data(res, i).decimal;
} /* dbi_result_get_double_idx */
const char *
dbi_result_get_string_idx(dbi_result res, unsigned int i)
{
- fail_unless(current_query->field_types[i] != DBI_TYPE_STRING,
- "dbi_result_get_string_idx() called for non-integer "
- "column type %u", current_query->field_types[i]);
+ fail_unless(current_query->field_types[i - 1] == DBI_TYPE_STRING,
+ "dbi_result_get_string_idx() called for non-string "
+ "column type %u", current_query->field_types[i - 1]);
return get_golden_data(res, i).string;
} /* dbi_result_get_string_idx */
time_t
dbi_result_get_datetime_idx(dbi_result res, unsigned int i)
{
- fail_unless(current_query->field_types[i] != DBI_TYPE_DATETIME,
- "dbi_result_get_datetime_idx() called for non-integer "
- "column type %u", current_query->field_types[i]);
+ fail_unless(current_query->field_types[i - 1] == DBI_TYPE_DATETIME,
+ "dbi_result_get_datetime_idx() called for non-datetime "
+ "column type %u", current_query->field_types[i - 1]);
return get_golden_data(res, i).datetime;
} /* dbi_result_get_datetime_idx */
/* this will check if the parameters are valid */
get_golden_data(res, i);
- switch (current_query->field_types[i]) {
+ switch (current_query->field_types[i - 1]) {
case DBI_TYPE_INTEGER:
return sizeof(long long);
break;
fail("INTERNAL ERROR: dbi_result_get_field_length_idx() "
"called for unexpected field type %u",
- current_query->field_types[i]);
+ current_query->field_types[i - 1]);
return 0;
} /* dbi_result_get_field_length_idx */
const unsigned char *
dbi_result_get_binary_idx(dbi_result res, unsigned int i)
{
- fail_unless(current_query->field_types[i] != DBI_TYPE_BINARY,
- "dbi_result_get_binary_idx() called for non-integer "
- "column type %u", current_query->field_types[i]);
+ fail_unless(current_query->field_types[i - 1] == DBI_TYPE_BINARY,
+ "dbi_result_get_binary_idx() called for non-binary "
+ "column type %u", current_query->field_types[i - 1]);
return get_golden_data(res, i).binary.datum;
} /* dbi_result_get_binary_idx */
"column %zu; expected: %i", data[i].type, i,
expected_type);
- expected_data = golden_data[current_query->current_row - 1][i + 1];
+ expected_data = golden_data[current_query->current_row - 1][i];
switch (expected_type) {
case SDB_TYPE_INTEGER:
fail_unless(data[i].data.integer == expected_data.integer,