@@ -484,7 +484,7 @@ Handle<Value> MysqlStatement::FetchAllSync(const Arguments& args) {
484
484
// Get fields count for binding buffers
485
485
unsigned int field_count = mysql_stmt_field_count (stmt->_stmt );
486
486
487
- // Get meta data for binding buffers
487
+ // Get meta data for binding buffers
488
488
MYSQL_RES *meta = mysql_stmt_result_metadata (stmt->_stmt );
489
489
MYSQL_FIELD *fields = meta->fields ;
490
490
@@ -502,30 +502,30 @@ Handle<Value> MysqlStatement::FetchAllSync(const Arguments& args) {
502
502
memset (date_data, 0 , sizeof (date_data));
503
503
memset (bind, 0 , sizeof (bind));
504
504
505
- unsigned long string_size = 1024
506
- , size = 0 ;
505
+ unsigned long string_size = 1024
506
+ , size = 0 ;
507
507
508
- // temp: count min needed size for
509
- while (++i < field_count) {
510
- enum_field_types type = fields[i].type ;
511
- if (
512
- type == MYSQL_TYPE_TINY_BLOB ||
513
- type == MYSQL_TYPE_MEDIUM_BLOB ||
508
+ // temp: count min needed size for
509
+ while (++i < field_count) {
510
+ enum_field_types type = fields[i].type ;
511
+ if (
512
+ type == MYSQL_TYPE_TINY_BLOB ||
513
+ type == MYSQL_TYPE_MEDIUM_BLOB ||
514
514
type == MYSQL_TYPE_LONG_BLOB ||
515
515
type == MYSQL_TYPE_BLOB ||
516
516
type == MYSQL_TYPE_STRING ||
517
517
type == MYSQL_TYPE_VAR_STRING) {
518
- size = fields[i].length ;
519
- if (size > string_size) {
520
- string_size = size;
521
- }
522
- }
523
- }
518
+ size = fields[i].length ;
519
+ if (size > string_size) {
520
+ string_size = size;
521
+ }
522
+ }
523
+ }
524
524
525
- DEBUG_PRINT (" Final string size: %lu\n " , string_size);
525
+ DEBUG_PRINT (" Final string size: %lu\n " , string_size);
526
526
527
527
char str_data[field_count][string_size];
528
- i = 0 ;
528
+ i = 0 ;
529
529
530
530
while (i < field_count) {
531
531
bind[i].buffer_type = fields[i].type ;
@@ -702,23 +702,23 @@ Handle<Value> MysqlStatement::FetchAllSync(const Arguments& args) {
702
702
case MYSQL_TYPE_BLOB:
703
703
case MYSQL_TYPE_STRING:
704
704
case MYSQL_TYPE_VAR_STRING:
705
- if (fields[j].flags & BINARY_FLAG) {
705
+ if (fields[j].flags & BINARY_FLAG) {
706
706
DEBUG_PRINT (" \t\t Blob, length: (%lu)\n " , length[j]);
707
707
708
- // taken from: http://sambro.is-super-awesome.com/2011/03/03/creating-a-proper-buffer-in-a-node-c-addon/
709
- node::Buffer *slowBuffer = node::Buffer::New (length[j]);
710
- memcpy (node::Buffer::Data (slowBuffer), str_data[j], length[j]);
711
- v8::Local<v8::Object> globalObj = v8::Context::GetCurrent ()->Global ();
712
- v8::Local<v8::Function> bufferConstructor = v8::Local<v8::Function>::Cast (globalObj->Get (v8::String::New (" Buffer" )));
713
- v8::Handle <v8::Value> constructorArgs[3 ] = { slowBuffer->handle_ , v8::Integer::New (length[j]), v8::Integer::New (0 ) };
714
- js_field = bufferConstructor->NewInstance (3 , constructorArgs);
715
- } else {
708
+ // taken from: http://sambro.is-super-awesome.com/2011/03/03/creating-a-proper-buffer-in-a-node-c-addon/
709
+ node::Buffer *slowBuffer = node::Buffer::New (length[j]);
710
+ memcpy (node::Buffer::Data (slowBuffer), str_data[j], length[j]);
711
+ v8::Local<v8::Object> globalObj = v8::Context::GetCurrent ()->Global ();
712
+ v8::Local<v8::Function> bufferConstructor = v8::Local<v8::Function>::Cast (globalObj->Get (v8::String::New (" Buffer" )));
713
+ v8::Handle <v8::Value> constructorArgs[3 ] = { slowBuffer->handle_ , v8::Integer::New (length[j]), v8::Integer::New (0 ) };
714
+ js_field = bufferConstructor->NewInstance (3 , constructorArgs);
715
+ } else {
716
716
DEBUG_PRINT (" \t\t String: %s (%lu)\n " , str_data[j], length[j]);
717
- js_field = V8STR2 (str_data[j], length[j]);
718
- }
717
+ js_field = V8STR2 (str_data[j], length[j]);
718
+ }
719
719
720
- break ;
721
- default :
720
+ break ;
721
+ default :
722
722
DEBUG_PRINT (" \t\t Default (as string): %s\n " , str_data[j]);
723
723
js_field = V8STR2 (str_data[j], length[j]);
724
724
break ;
0 commit comments