19 buf[
n] =
'a' + ((start+
n) * step % (
'z' -
'a' + 1));
28 sprintf(
buf + 2*
n,
"%2x", (
unsigned int)(
'a' + ((start+
n) * step % (
'z' -
'a' + 1))));
38 if (
buf[
n] !=
'a' + ((start+
n) * step % (
'z' -
'a' + 1)))
50 for (
n = 0;
n <
len; ++
n) {
51 sprintf(symbol,
"%2x", (
unsigned int)(
'a' + ((start+
n) / 2 * step % (
'z' -
'a' + 1))));
52 if (
tolower((
unsigned char)
buf[
n]) != symbol[(start+
n) % 2])
79 fprintf(
out,
"%s", start);
80 for (
n = 0;
n <
len; ++
n) {
81 unsigned char c = ((
unsigned char*)
buf)[
n];
82 fprintf(
out,
" %02X", c);
83 s[
n] = (c >= 0x20 && c < 127) ? (
char) c :
'.';
86 fprintf(
out,
" - %s\n", s);
98 printf(
">> readBlob field %d\n",
t->num);
106 printf(
">> step %d: %d bytes readed\n",
i, (
int)
len);
109 fprintf(stderr,
"Wrong buffer content\n");
115 printf(
">> total bytes read = %d \n", (
int) total);
116 if (total != 10000) {
117 fprintf(stderr,
"Wrong buffer length, expected 20000\n");
133 unsigned int char_len = 1;
142 printf(
">> readBlobAsChar field %d\n",
t->num);
158 len -=
len % (2u * char_len);
160 printf(
">> step %d: %d bytes readed\n",
i, (
int)
len);
169 fprintf(stderr,
"Wrong buffer content\n");
175 printf(
">> total bytes read = %d \n", (
int) total);
176 if (total != 20000) {
177 fprintf(stderr,
"Wrong buffer length, expected 20000\n");
189 fprintf(stderr,
"too max tests\n");
196 t->sql_type = sql_type;
197 t->db_type = db_type;
211 t->buf = (
char*)
malloc(buf_len);
213 fprintf(stderr,
"memory error\n");
219 memset(
t->buf, 0, buf_len);
262 strcpy(
sql,
"CREATE TABLE #tt(k INT");
264 sprintf(strchr(
sql, 0),
",f%u %s",
t->num,
t->db_type);
273 for (
i = 0;
i <
cnt;
i++) {
280 strcpy(
sql,
"INSERT INTO #tt VALUES(?");
295 printf(
">> insert... %d\n",
i);
301 printf(
">> SQLParamData: ptr = %p RetCode = %d\n", (
void *) p, RetCode);
307 unsigned char_len = 1;
317 printf(
">> param %p: total bytes written = %d\n", (
void *) p,
NBYTES - (
i&1));
321 printf(
">> param %p: total bytes written = %d\n", (
void *) p,
NBYTES + (
i&1));
325 printf(
">> param %p: total bytes written = %d\n", (
void *) p,
NBYTES);
336 for (wide = 0; wide < 2; ++wide)
337 for (
i = 0;
i <
cnt;
i++) {
350 strcpy(
sql,
"SELECT ");
352 sprintf(strchr(
sql, 0),
"f%u,",
t->num);
369 printf(
">> fetch... %d\n",
i);
#define CHKBindParameter(a, b, c, d, e, f, g, h, i, res)
#define CHKPrepare(a, b, res)
#define CHKAllocHandle(a, b, c, res)
#define CHKGetData(a, b, c, d, e, res)
#define odbc_command(cmd)
#define CHKBindCol(a, b, c, d, e, res)
#define CHKPutData(a, b, res)
#define CHKFetchScroll(a, b, res)
#define CHKFreeHandle(a, b, res)
#define CHKCloseCursor(res)
#define CHKSetStmtAttr(a, b, c, res)
#define CHKParamData(a, res)
std::ofstream out("events_result.xml")
main entry point for tests
static SQLRETURN odbc_connect(TDS_DBC *dbc, TDSLOGIN *login)
static unsigned num_tests
static test_info test_infos[10]
static int check_chars(const char *buf, size_t len, SQLINTEGER start, unsigned int step)
static void dump(FILE *out, const char *start, void *buf, SQLUINTEGER len)
static void readBlob(test_info *t)
static void readBlobAsChar(test_info *t, int step, int wide)
int main(int argc, char **argv)
static void fill_hex(char *buf, size_t len, unsigned int start, unsigned int step)
static void fill_chars(char *buf, size_t len, unsigned int start, unsigned int step)
static int check_hex(const char *buf, size_t len, SQLINTEGER start, unsigned int step)
static void add_test(SQLSMALLINT c_type, SQLSMALLINT sql_type, const char *db_type, unsigned gen1, unsigned gen2)
static void free_tests(void)
int odbc_disconnect(void)
SQLINTEGER odbc_to_sqlwchar(SQLWCHAR *dst, const char *src, SQLINTEGER n)
int odbc_db_is_microsoft(void)
int odbc_driver_is_freetds(void)
SQLINTEGER odbc_from_sqlwchar(char *dst, const SQLWCHAR *src, SQLINTEGER n)
const struct ncbi::grid::netcache::search::fields::KEY key
static PCRE2_SIZE bufsize
#define SQL_ATTR_CURSOR_SCROLLABLE
#define SQL_NONSCROLLABLE
#define SQL_SUCCESS_WITH_INFO
#define SQL_ATTR_CURSOR_SENSITIVITY
#define SQL_LONGVARBINARY
#define SQL_LEN_DATA_AT_EXEC(length)
signed short int SQLSMALLINT