Merge lp:~linuxjedi/libdrizzle/5.1-fixes into lp:libdrizzle

Proposed by Andrew Hutchings
Status: Merged
Approved by: Andrew Hutchings
Approved revision: 116
Merged at revision: 115
Proposed branch: lp:~linuxjedi/libdrizzle/5.1-fixes
Merge into: lp:libdrizzle
Diff against target: 83 lines (+13/-5)
4 files modified
libdrizzle/field.cc (+0/-2)
libdrizzle/result.cc (+1/-0)
libdrizzle/row.cc (+11/-2)
libdrizzle/statement_param.cc (+1/-1)
To merge this branch: bzr merge lp:~linuxjedi/libdrizzle/5.1-fixes
Reviewer Review Type Date Requested Status
Drizzle Trunk Pending
Review via email: mp+160823@code.launchpad.net

Description of the change

Fixes the following things:
1. Compile error in Ubuntu 13.04
2. Row allocation clearer and wastes less memory (at a later date we should probably make field_t a struct of data and length to improve this further)
3. Remove unnecessary push/pop in field code

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libdrizzle/field.cc'
2--- libdrizzle/field.cc 2013-04-24 18:42:59 +0000
3+++ libdrizzle/field.cc 2013-04-25 09:08:32 +0000
4@@ -285,9 +285,7 @@
5 }
6 else
7 {
8- con->pop_state();
9 con->push_state(drizzle_state_packet_read);
10- con->push_state(drizzle_state_field_read);
11 }
12 }
13
14
15=== modified file 'libdrizzle/result.cc'
16--- libdrizzle/result.cc 2013-03-11 18:10:23 +0000
17+++ libdrizzle/result.cc 2013-04-25 09:08:32 +0000
18@@ -101,6 +101,7 @@
19 {
20 delete[] result->null_bitmap_list[x];
21 }
22+ delete[] result->field_sizes_list[x];
23 }
24 if (result->null_bitmap_list != NULL)
25 {
26
27=== modified file 'libdrizzle/row.cc'
28--- libdrizzle/row.cc 2013-04-22 19:14:35 +0000
29+++ libdrizzle/row.cc 2013-04-25 09:08:32 +0000
30@@ -106,7 +106,7 @@
31 return NULL;
32 }
33
34- result->row= new (std::nothrow) drizzle_field_t[sizeof(size_t) * result->column_count];
35+ result->row= new (std::nothrow) drizzle_field_t[result->column_count];
36 if (result->row == NULL)
37 {
38 drizzle_set_error(result->con, __func__, "Failed to allocate.");
39@@ -114,7 +114,13 @@
40 return NULL;
41 }
42
43- result->field_sizes= (size_t *)(result->row + result->column_count);
44+ result->field_sizes= new (std::nothrow) size_t[result->column_count];
45+ if (result->field_sizes == NULL)
46+ {
47+ drizzle_set_error(result->con, __func__, "Failed to allocate.");
48+ *ret_ptr= DRIZZLE_RETURN_MEMORY;
49+ return NULL;
50+ }
51 }
52
53 while (1)
54@@ -128,6 +134,7 @@
55 if (*ret_ptr != DRIZZLE_RETURN_IO_WAIT)
56 {
57 delete[] result->row;
58+ delete[] result->field_sizes;
59 result->row= NULL;
60 result->field_sizes= NULL;
61 }
62@@ -164,6 +171,8 @@
63 {
64 delete[] result->null_bitmap;
65 result->null_bitmap= NULL;
66+ delete[] result->field_sizes;
67+ result->field_sizes= NULL;
68 }
69
70 delete[] row;
71
72=== modified file 'libdrizzle/statement_param.cc'
73--- libdrizzle/statement_param.cc 2013-04-24 18:42:59 +0000
74+++ libdrizzle/statement_param.cc 2013-04-25 09:08:32 +0000
75@@ -56,7 +56,7 @@
76 }
77
78 stmt->query_params[param_num].type= type;
79- stmt->query_params[param_num].data= data;
80+ stmt->query_params[param_num].data= (void*)data;
81 stmt->query_params[param_num].length= length;
82 stmt->query_params[param_num].options.is_unsigned= is_unsigned;
83 stmt->query_params[param_num].is_bound= true;

Subscribers

People subscribed via source and target branches

to all changes:
to status/vote changes: