- Timestamp:
- 06/18/12 21:54:20 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/InterpreterV8.cc
r14177 r14185 341 341 342 342 Handle<Array> ret = Array::New(); 343 ret->Set(String::New("table"), String::New(res.table())); 343 ret->Set(String::New("table"), String::New(res.table()), ReadOnly); 344 345 Handle<Array> cols = Array::New(); 344 346 345 347 int irow=0; … … 353 355 { 354 356 const Handle<Value> name = String::New((*list)[i].c_str()); 357 if (irow==0) 358 cols->Set(Integer::NewFromUnsigned(i), name, ReadOnly); 355 359 356 360 if ((*it)[i].is_null()) 357 361 { 358 row->Set(name, Undefined() );362 row->Set(name, Undefined(), ReadOnly); 359 363 continue; 360 364 } … … 370 374 const uint64_t val = (uint64_t)(*it)[i]; 371 375 if (val>UINT32_MAX) 372 row->Set(name, Number::New(val) );376 row->Set(name, Number::New(val), ReadOnly); 373 377 else 374 row->Set(name, Integer::NewFromUnsigned(val) );378 row->Set(name, Integer::NewFromUnsigned(val), ReadOnly); 375 379 } 376 380 else … … 378 382 const int64_t val = (int64_t)(*it)[i]; 379 383 if (val<INT32_MIN || val>INT32_MAX) 380 row->Set(name, Number::New(val) );384 row->Set(name, Number::New(val), ReadOnly); 381 385 else 382 row->Set(name, Integer::NewFromUnsigned(val) );386 row->Set(name, Integer::NewFromUnsigned(val), ReadOnly); 383 387 } 384 388 continue; … … 389 393 { 390 394 if (uns) 391 row->Set(name, Integer::NewFromUnsigned((uint32_t)(*it)[i]) );395 row->Set(name, Integer::NewFromUnsigned((uint32_t)(*it)[i]), ReadOnly); 392 396 else 393 row->Set(name, Integer::New((int32_t)(*it)[i]) );397 row->Set(name, Integer::New((int32_t)(*it)[i]), ReadOnly); 394 398 } 395 399 396 400 if (sql_type.find("BOOL")!=string::npos ) 397 401 { 398 row->Set(name, Boolean::New((bool)(*it)[i]) );402 row->Set(name, Boolean::New((bool)(*it)[i]), ReadOnly); 399 403 continue; 400 404 } … … 404 408 ostringstream val; 405 409 val << setprecision(7) << (float)(*it)[i]; 406 row->Set(name, Number::New(stod(val.str())) );410 row->Set(name, Number::New(stod(val.str())), ReadOnly); 407 411 continue; 408 412 … … 410 414 if (sql_type.find("DOUBLE")!=string::npos) 411 415 { 412 row->Set(name, Number::New((double)(*it)[i]) );416 row->Set(name, Number::New((double)(*it)[i]), ReadOnly); 413 417 continue; 414 418 } … … 417 421 sql_type.find("TEXT")!=string::npos) 418 422 { 419 row->Set(name, String::New((const char*)(*it)[i]) );423 row->Set(name, String::New((const char*)(*it)[i]), ReadOnly); 420 424 continue; 421 425 } … … 423 427 if (sql_type.find("TIMESTAMP")!=string::npos) 424 428 { 425 row->Set(name, Date::New(time_t(mysqlpp::Time((*it)[i]))*1000) );429 row->Set(name, Date::New(time_t(mysqlpp::Time((*it)[i]))*1000), ReadOnly); 426 430 continue; 427 431 } … … 429 433 if (sql_type.find("DATETIME")!=string::npos) 430 434 { 431 row->Set(name, Date::New(time_t(mysqlpp::DateTime((*it)[i]))*1000) );435 row->Set(name, Date::New(time_t(mysqlpp::DateTime((*it)[i]))*1000), ReadOnly); 432 436 continue; 433 437 } … … 435 439 if (sql_type.find(" DATE ")!=string::npos) 436 440 { 437 row->Set(name, Date::New(time_t((mysqlpp::Date)(*it)[i])*1000) );441 row->Set(name, Date::New(time_t((mysqlpp::Date)(*it)[i])*1000), ReadOnly); 438 442 continue; 439 443 } … … 441 445 } 442 446 443 ret->Set(Integer::New (irow++), row);447 ret->Set(Integer::NewFromUnsigned(irow++), row, ReadOnly); 444 448 } 449 450 if (irow>0) 451 ret->Set(String::New("cols"), cols, ReadOnly); 445 452 446 453 return handle_scope.Close(ret); … … 711 718 v8::Locker::StartPreemption(10); 712 719 const bool rc = ExecuteFile(filename); 720 721 // ----- 722 // This is how an exit handler could look like, but there is no way to interrupt it 723 // ----- 724 // Handle<Object> obj = Handle<Object>::Cast(context->Global()->Get(String::New("dim"))); 725 // if (!obj.IsEmpty()) 726 // { 727 // Handle<Value> onexit = obj->Get(String::New("onexit")); 728 // if (!onexit->IsUndefined()) 729 // Handle<Function>::Cast(onexit)->NewInstance(0, NULL); // argc, argv 730 // // Handle<Object> result = Handle<Function>::Cast(onexit)->NewInstance(0, NULL); // argc, argv 731 // } 732 713 733 v8::Locker::StopPreemption(); 714 734 //context->Exit(); … … 730 750 void InterpreterV8::JsStop() 731 751 { 732 v8::Locker locker;752 Locker locker; 733 753 //cout << "Terminate " << fThreadId << endl; 734 754 if (This->fThreadId>=0) 735 v8::V8::TerminateExecution(This->fThreadId);755 V8::TerminateExecution(This->fThreadId); 736 756 //cout << "Terminate " << fThreadId << endl; 737 v8::Unlocker unlocker;757 Unlocker unlocker; 738 758 } 739 759
Note:
See TracChangeset
for help on using the changeset viewer.