Exemplo n.º 1
0
int main(void)
{
    close(STDOUT_FILENO);

    drizzle_st *drizzle;
    drizzle_query_st *query;
    drizzle_query_st query_buffer;
    size_t size;

    printf("sizeof(drizzle_query_st) = %zu\n", sizeof(drizzle_query_st));

    if ((drizzle= drizzle_create(NULL)) == NULL)
        drizzle_test_error("drizzle_create");

    if ((query= drizzle_query_create(drizzle, &query_buffer)) == NULL)
        drizzle_test_error("drizzle_query_create");
    drizzle_query_free(query);

    if ((query= drizzle_query_create(drizzle, NULL)) == NULL)
        drizzle_test_error("drizzle_query_create");

    if (drizzle_query_options(query) != DRIZZLE_QUERY_ALLOCATED)
        drizzle_test_error("drizzle_query_options");

    drizzle_query_set_string(query, "SELECT 1+1", 10);

    if (strncmp(drizzle_query_string(query, &size), "SELECT 1+1", 10) ||
            size != 10)
    {
        drizzle_test_error("drizzle_query_string");
    }

    drizzle_query_free(query);
    drizzle_free(drizzle);

    return 0;
}
Exemplo n.º 2
0
Arquivo: query.c Projeto: ezaze/youku
void drizzle_query_free_all(drizzle_st *drizzle)
{
  while (drizzle->query_list != NULL)
    drizzle_query_free(drizzle->query_list);
}