Rev 1950 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1950 | Rev 1952 | ||
|---|---|---|---|
| Line 170... | Line 170... | ||
| 170 | 170 | ||
| 171 | //atom::log::Debug(log_module_, "%s called!", __FUNCTION__); |
171 | //atom::log::Debug(log_module_, "%s called!", __FUNCTION__); |
| 172 | 172 | ||
| 173 | try |
173 | try |
| 174 | { |
174 | { |
| 175 |
|
175 | v8::Local<v8::Array> result_array = v8::Array::New(); |
| 176 | 176 | ||
| 177 | ATOM_VM_PLUGIN_NUM_PARAMS(2); |
177 | ATOM_VM_PLUGIN_NUM_PARAMS(2); |
| 178 | 178 | ||
| 179 | v8::String::AsciiValue query(args[1]); |
179 | v8::String::AsciiValue query(args[1]); |
| 180 | 180 | ||
| Line 193... | Line 193... | ||
| 193 | throw atom::exception::action_failed(); |
193 | throw atom::exception::action_failed(); |
| 194 | } |
194 | } |
| 195 | 195 | ||
| 196 | 196 | ||
| 197 | /* Get the result */ |
197 | /* Get the result */ |
| 198 | result = mysql_store_result(MySql::resources_[(ResourceId)args[0]->Uint32Value()]); |
198 | result = mysql_store_result(MySql::resources_[(ResourceId)args[0]->Uint32Value()]); |
| 199 | 199 | ||
| 200 | if (NULL == result) |
200 | if (NULL == result) |
| 201 | { |
201 | { |
| 202 | if (mysql_field_count(MySql::resources_[(ResourceId)args[0]->Uint32Value()]) > 0) |
202 | if (mysql_field_count(MySql::resources_[(ResourceId)args[0]->Uint32Value()]) > 0) |
| 203 | { |
203 | { |
| Line 210... | Line 210... | ||
| 210 | 210 | ||
| 211 | MYSQL_ROW row; |
211 | MYSQL_ROW row; |
| 212 | uint32_t number_of_fields = mysql_num_fields(result); |
212 | uint32_t number_of_fields = mysql_num_fields(result); |
| 213 | MYSQL_FIELD* fields = mysql_fetch_fields(result); |
213 | MYSQL_FIELD* fields = mysql_fetch_fields(result); |
| 214 | uint32_t row_index = 0; |
214 | uint32_t row_index = 0; |
| 215 | - | ||
| 216 | v8::Local<v8::Array> result_array = v8::Array::New(); |
- | |
| 217 | - | ||
| 218 | 215 | ||
| 219 | while (NULL != (row = mysql_fetch_row(result))) |
216 | while (NULL != (row = mysql_fetch_row(result))) |
| 220 | { |
217 | { |
| 221 | v8::Local<v8::Object> vars = v8::Object::New(); |
218 | v8::Local<v8::Object> vars = v8::Object::New(); |
| 222 | 219 | ||
| Line 232... | Line 229... | ||
| 232 | row_index++; |
229 | row_index++; |
| 233 | } |
230 | } |
| 234 | 231 | ||
| 235 | mysql_free_result(result); |
232 | mysql_free_result(result); |
| 236 | result = NULL; |
233 | result = NULL; |
| 237 | - | ||
| 238 | return handle_scope.Close(v8::Handle<v8::Value>(result_array)); |
- | |
| 239 | } |
234 | } |
| 240 | 235 | ||
| 241 | return handle_scope.Close(v8:: |
236 | return handle_scope.Close(v8::Handle<v8::Value>(result_array)); |
| 242 | } |
237 | } |
| 243 | catch (std::exception& exception) |
238 | catch (std::exception& exception) |
| 244 | { |
239 | { |
| 245 | if (NULL != result) |
240 | if (NULL != result) |
| 246 | { |
241 | { |