~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to unittests/drizzle_query_st.c

  • Committer: Monty Taylor
  • Date: 2010-08-13 05:44:32 UTC
  • mto: (1720.1.5 build)
  • mto: This revision was merged to the branch mainline in revision 1722.
  • Revision ID: mordred@inaugust.com-20100813054432-8vg4o5b1cgalj6ce
Killed the old libdrizzle unittests - they crash hades.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Drizzle Client & Protocol Library
3
 
 *
4
 
 * Copyright (C) 2008 Eric Day (eday@oddments.org)
5
 
 * All rights reserved.
6
 
 *
7
 
 * Use and distribution licensed under the BSD license.  See
8
 
 * the COPYING file in this directory for full text.
9
 
 */
10
 
 
11
 
/**
12
 
 * @file
13
 
 * @brief drizzle_query_st tests
14
 
 */
15
 
 
16
 
#include "common.h"
17
 
 
18
 
int main(void)
19
 
{
20
 
  drizzle_st *drizzle;
21
 
  drizzle_query_st *query;
22
 
  drizzle_query_st query_buffer;
23
 
  size_t size;
24
 
 
25
 
  printf("sizeof(drizzle_query_st) = %zu\n", sizeof(drizzle_query_st));
26
 
 
27
 
  if ((drizzle= drizzle_create(NULL)) == NULL)
28
 
    drizzle_test_error("drizzle_create");
29
 
 
30
 
  if ((query= drizzle_query_create(drizzle, &query_buffer)) == NULL)
31
 
    drizzle_test_error("drizzle_query_create");
32
 
  drizzle_query_free(query);
33
 
 
34
 
  if ((query= drizzle_query_create(drizzle, NULL)) == NULL)
35
 
    drizzle_test_error("drizzle_query_create");
36
 
 
37
 
  if (drizzle_query_options(query) != DRIZZLE_QUERY_ALLOCATED)
38
 
    drizzle_test_error("drizzle_query_options");
39
 
 
40
 
  drizzle_query_set_string(query, "SELECT 1+1", 10);
41
 
 
42
 
  if (strncmp(drizzle_query_string(query, &size), "SELECT 1+1", 10) ||
43
 
      size != 10)
44
 
  {
45
 
    drizzle_test_error("drizzle_query_string");
46
 
  }
47
 
 
48
 
  drizzle_query_free(query);
49
 
  drizzle_free(drizzle);
50
 
 
51
 
  return 0;
52
 
}