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
=== modified file 'libdrizzle/field.cc'
--- libdrizzle/field.cc 2013-04-24 18:42:59 +0000
+++ libdrizzle/field.cc 2013-04-25 09:08:32 +0000
@@ -285,9 +285,7 @@
285 }285 }
286 else286 else
287 {287 {
288 con->pop_state();
289 con->push_state(drizzle_state_packet_read);288 con->push_state(drizzle_state_packet_read);
290 con->push_state(drizzle_state_field_read);
291 }289 }
292 }290 }
293291
294292
=== modified file 'libdrizzle/result.cc'
--- libdrizzle/result.cc 2013-03-11 18:10:23 +0000
+++ libdrizzle/result.cc 2013-04-25 09:08:32 +0000
@@ -101,6 +101,7 @@
101 {101 {
102 delete[] result->null_bitmap_list[x];102 delete[] result->null_bitmap_list[x];
103 }103 }
104 delete[] result->field_sizes_list[x];
104 }105 }
105 if (result->null_bitmap_list != NULL)106 if (result->null_bitmap_list != NULL)
106 {107 {
107108
=== modified file 'libdrizzle/row.cc'
--- libdrizzle/row.cc 2013-04-22 19:14:35 +0000
+++ libdrizzle/row.cc 2013-04-25 09:08:32 +0000
@@ -106,7 +106,7 @@
106 return NULL;106 return NULL;
107 }107 }
108108
109 result->row= new (std::nothrow) drizzle_field_t[sizeof(size_t) * result->column_count];109 result->row= new (std::nothrow) drizzle_field_t[result->column_count];
110 if (result->row == NULL)110 if (result->row == NULL)
111 {111 {
112 drizzle_set_error(result->con, __func__, "Failed to allocate.");112 drizzle_set_error(result->con, __func__, "Failed to allocate.");
@@ -114,7 +114,13 @@
114 return NULL;114 return NULL;
115 }115 }
116116
117 result->field_sizes= (size_t *)(result->row + result->column_count);117 result->field_sizes= new (std::nothrow) size_t[result->column_count];
118 if (result->field_sizes == NULL)
119 {
120 drizzle_set_error(result->con, __func__, "Failed to allocate.");
121 *ret_ptr= DRIZZLE_RETURN_MEMORY;
122 return NULL;
123 }
118 }124 }
119125
120 while (1)126 while (1)
@@ -128,6 +134,7 @@
128 if (*ret_ptr != DRIZZLE_RETURN_IO_WAIT)134 if (*ret_ptr != DRIZZLE_RETURN_IO_WAIT)
129 {135 {
130 delete[] result->row;136 delete[] result->row;
137 delete[] result->field_sizes;
131 result->row= NULL;138 result->row= NULL;
132 result->field_sizes= NULL;139 result->field_sizes= NULL;
133 }140 }
@@ -164,6 +171,8 @@
164 { 171 {
165 delete[] result->null_bitmap;172 delete[] result->null_bitmap;
166 result->null_bitmap= NULL;173 result->null_bitmap= NULL;
174 delete[] result->field_sizes;
175 result->field_sizes= NULL;
167 } 176 }
168177
169 delete[] row;178 delete[] row;
170179
=== modified file 'libdrizzle/statement_param.cc'
--- libdrizzle/statement_param.cc 2013-04-24 18:42:59 +0000
+++ libdrizzle/statement_param.cc 2013-04-25 09:08:32 +0000
@@ -56,7 +56,7 @@
56 }56 }
5757
58 stmt->query_params[param_num].type= type;58 stmt->query_params[param_num].type= type;
59 stmt->query_params[param_num].data= data;59 stmt->query_params[param_num].data= (void*)data;
60 stmt->query_params[param_num].length= length;60 stmt->query_params[param_num].length= length;
61 stmt->query_params[param_num].options.is_unsigned= is_unsigned;61 stmt->query_params[param_num].options.is_unsigned= is_unsigned;
62 stmt->query_params[param_num].is_bound= true;62 stmt->query_params[param_num].is_bound= true;

Subscribers

People subscribed via source and target branches

to all changes:
to status/vote changes: