~linuxjedi/libdrizzle/5.1-mingw-docs

« back to all changes in this revision

Viewing changes to tests/unit/statement.c

  • Committer: Continuous Integration
  • Date: 2012-12-31 10:05:01 UTC
  • mfrom: (73.2.6 5.1-prep-stmt-cleanup)
  • Revision ID: ci@drizzle.org-20121231100501-7hgcm2i3v9fpp5gu
Merge lp:~linuxjedi/libdrizzle/5.1-prep-stmt-cleanup Build: jenkins-Libdrizzle-27

Show diffs side-by-side

added added

removed removed

Lines of Context:
91
91
  ASSERT_EQ_(1, drizzle_stmt_param_count(stmt), "Retrieved bad param count");
92
92
 
93
93
  uint32_t val= 1;
94
 
  ret = drizzle_stmt_bind_param(stmt, 0, DRIZZLE_COLUMN_TYPE_LONG, &val, 4, DRIZZLE_BIND_OPTION_NONE);
 
94
  ret = drizzle_stmt_set_int(stmt, 0, val, false);
95
95
  if (ret != DRIZZLE_RETURN_OK)
96
96
  {
97
97
    printf("Bind failure\n");
119
119
  uint32_t i= 1;
120
120
  while (drizzle_stmt_fetch(stmt) != DRIZZLE_RETURN_ROW_END)
121
121
  {
122
 
    uint32_t *res_val;
123
 
    res_val= (uint32_t*)drizzle_stmt_item_data(stmt, 0);
 
122
    uint32_t res_val;
 
123
    const char* char_val;
 
124
    char comp_val[3];
 
125
    size_t len;
 
126
    res_val= drizzle_stmt_get_int(stmt, 0, &ret);
 
127
    ASSERT_EQ_(DRIZZLE_RETURN_OK, ret, "drizzle_stmt_get_int");
 
128
    char_val= drizzle_stmt_get_string(stmt, 0, &len, &ret);
 
129
    ASSERT_EQ_(DRIZZLE_RETURN_OK, ret, "drizzle_stmt_get_string");
124
130
    i++;
125
 
    if (*res_val != i)
126
 
    {
127
 
      printf("Retrieved unexpected value\n");
 
131
    if (res_val != i)
 
132
    {
 
133
      printf("Retrieved unexpected int value\n");
 
134
      return EXIT_FAILURE;
 
135
    }
 
136
    snprintf(comp_val, 3, "%"PRIu32, i);
 
137
    if (strcmp(comp_val, char_val) != 0)
 
138
    {
 
139
      printf("Retrieved unexpected string value\n");
128
140
      return EXIT_FAILURE;
129
141
    }
130
142
  }