~drizzle-trunk/libdrizzle/jenkins-Libdrizzle-10

« back to all changes in this revision

Viewing changes to tests/unit/unbuffered_query.c

  • Committer: Continuous Integration
  • Date: 2012-12-27 22:20:37 UTC
  • mfrom: (62.2.4 5.1-tests)
  • Revision ID: ci@drizzle.org-20121227222037-7ppxx42d00f6h58j
Merge lp:~linuxjedi/libdrizzle/5.1-tests Build: jenkins-Libdrizzle-10

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
 *
36
36
 */
37
37
 
38
 
#include "config.h"
39
 
 
40
38
#include <libdrizzle-5.1/libdrizzle.h>
41
39
#include <stdio.h>
42
40
#include <stdlib.h>
 
41
#include <string.h>
43
42
 
44
43
#ifndef EXIT_SKIP
45
44
# define EXIT_SKIP 77
97
96
  }
98
97
  num_fields= drizzle_result_column_count(result);
99
98
 
100
 
  printf("%d fields\n", num_fields);
 
99
  if (num_fields != 1)
 
100
  {
 
101
    printf("Retrieved bad number of fields\n");
 
102
    return EXIT_FAILURE;
 
103
  }
 
104
 
 
105
  int i= 0;
 
106
  char buf[10];
101
107
  while(1)
102
108
  {
103
109
    row= drizzle_row_buffer(result, &ret);
111
117
      // EOF
112
118
      break;
113
119
    }
114
 
    printf("Data: %s\n", row[0]);
 
120
    i++;
 
121
    snprintf(buf, 10, "%d", i);
 
122
    if (strcmp(row[0], buf) != 0)
 
123
    {
 
124
      printf("Retrieved bad row data\n");
 
125
      return EXIT_FAILURE;
 
126
    }
115
127
    drizzle_row_free(result, row);
116
128
  }
 
129
  /* we should have had 3 rows */
 
130
  if (i != 3)
 
131
  {
 
132
    printf("Retrieved bad number of rows\n");
 
133
    return EXIT_FAILURE;
 
134
  }
117
135
 
118
136
  drizzle_result_free(result);
119
137