~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to libdrizzle-2.0/query.cc

  • Committer: Mark Atwood
  • Date: 2011-11-30 07:06:47 UTC
  • mfrom: (2463.1.6 drizzle-include)
  • Revision ID: me@mark.atwood.name-20111130070647-ixp7oalp70hkbt6l
mergeĀ lp:~brianaker/drizzle/libdrizzle-2.0-not-install

Show diffs side-by-side

added added

removed removed

Lines of Context:
72
72
                                    drizzle_con_st *con,
73
73
                                    drizzle_result_st *result,
74
74
                                    const char *query_string, size_t size,
75
 
                                    drizzle_query_options_t options,
 
75
                                    drizzle_query_options_t,
76
76
                                    void *context)
77
77
{
78
78
  // @note drizzle_query_st handle the null drizzle case
85
85
  drizzle_query_set_con(query, con);
86
86
  drizzle_query_set_result(query, result);
87
87
  drizzle_query_set_string(query, query_string, size);
88
 
  drizzle_query_add_options(query, options);
89
88
  drizzle_query_set_context(query, context);
90
89
 
91
90
  return query;
92
91
}
93
92
 
94
 
drizzle_query_st *drizzle_query_create(drizzle_st *drizzle,
95
 
                                       drizzle_query_st *query)
 
93
drizzle_query_st *drizzle_query_create(drizzle_st *drizzle, drizzle_query_st *query)
96
94
{
97
95
  if (drizzle == NULL)
98
96
  {
107
105
    {
108
106
      return NULL;
109
107
    }
110
 
    query->options|= DRIZZLE_CON_ALLOCATED;
 
108
    query->options.is_allocated= true;
111
109
  }
112
110
  else
113
111
  {
114
112
    query->prev= NULL;
115
 
    query->options= 0;
116
113
    query->state= DRIZZLE_QUERY_STATE_INIT;
117
114
    query->con= NULL;
118
115
    query->result= NULL;
120
117
    query->size= 0;
121
118
    query->context= NULL;
122
119
    query->context_free_fn= NULL;
 
120
    query->options.is_allocated= false;
123
121
  }
124
122
 
125
123
  query->drizzle= drizzle;
144
142
  }
145
143
 
146
144
  if (query->context != NULL && query->context_free_fn != NULL)
 
145
  {
147
146
    query->context_free_fn(query, query->context);
 
147
  }
148
148
 
149
149
  if (query->drizzle->query_list == query)
 
150
  {
150
151
    query->drizzle->query_list= query->next;
 
152
  }
151
153
 
152
154
  if (query->prev)
 
155
  {
153
156
    query->prev->next= query->next;
 
157
  }
154
158
 
155
159
  if (query->next)
 
160
  {
156
161
    query->next->prev= query->prev;
 
162
  }
157
163
 
158
164
  query->drizzle->query_count--;
159
165
 
160
 
  if (query->options & DRIZZLE_QUERY_ALLOCATED)
 
166
  if (query->options.is_allocated)
 
167
  {
161
168
    delete query;
 
169
  }
162
170
}
163
171
 
164
172
void drizzle_query_free_all(drizzle_st *drizzle)
233
241
  query->size= size;
234
242
}
235
243
 
236
 
int drizzle_query_options(drizzle_query_st *query)
237
 
{
238
 
  if (query == NULL)
239
 
  {
240
 
    return 0;
241
 
  }
242
 
 
243
 
  return query->options;
244
 
}
245
 
 
246
 
void drizzle_query_set_options(drizzle_query_st *query,
247
 
                               int options)
248
 
{
249
 
  if (query == NULL)
250
 
  {
251
 
    return;
252
 
  }
253
 
 
254
 
  query->options= options;
255
 
}
256
 
 
257
 
void drizzle_query_add_options(drizzle_query_st *query,
258
 
                               int options)
259
 
{
260
 
  if (query == NULL)
261
 
  {
262
 
    return;
263
 
  }
264
 
 
265
 
  query->options|= options;
266
 
}
267
 
 
268
 
void drizzle_query_remove_options(drizzle_query_st *query,
269
 
                                  int options)
270
 
{
271
 
  if (query == NULL)
272
 
  {
273
 
    return;
274
 
  }
275
 
 
276
 
  query->options&= ~options;
 
244
int drizzle_query_options(drizzle_query_st *)
 
245
{
 
246
  return 0;
 
247
}
 
248
 
 
249
void drizzle_query_set_options(drizzle_query_st *, int)
 
250
{
 
251
}
 
252
 
 
253
void drizzle_query_add_options(drizzle_query_st *, int)
 
254
{
 
255
}
 
256
 
 
257
void drizzle_query_remove_options(drizzle_query_st *, int)
 
258
{
277
259
}
278
260
 
279
261
void *drizzle_query_context(drizzle_query_st *query)