@@ -487,12 +487,6 @@ void Database::JS_new(v8::FunctionCallbackInfo<v8 ::Value> const& info) {
487
487
" seventh"
488
488
" argument" );
489
489
v8 ::Local<v8 ::Value> logger = info[6 ];
490
- if (info.Length () <= (7 ))
491
- return ThrowTypeError (
492
- " Expected a "
493
- " eighth"
494
- " argument" );
495
- v8 ::Local<v8 ::Value> buffer = info[7 ];
496
490
497
491
Addon* addon = static_cast <Addon*>(info.Data ().As <v8 ::External>()->Value ());
498
492
v8 ::Isolate* isolate = info.GetIsolate ();
@@ -520,14 +514,6 @@ void Database::JS_new(v8::FunctionCallbackInfo<v8 ::Value> const& info) {
520
514
int status = sqlite3_db_config (db_handle, SQLITE_DBCONFIG_DEFENSIVE, 1 , NULL );
521
515
assert (status == SQLITE_OK);
522
516
523
- if (node::Buffer::HasInstance (buffer) &&
524
- !Deserialize (buffer.As <v8::Object>(), addon, db_handle, readonly)) {
525
- int status = sqlite3_close (db_handle);
526
- assert (status == SQLITE_OK);
527
- ((void )status);
528
- return ;
529
- }
530
-
531
517
v8 ::Local<v8 ::Context> ctx = isolate->GetCurrentContext ();
532
518
Database* db = new Database (isolate, addon, db_handle, logger);
533
519
db->Wrap (info.This ());
@@ -1013,41 +999,6 @@ void Database::JS_inTransaction(
1013
999
info.GetReturnValue ().Set (
1014
1000
db->open && !static_cast <bool >(sqlite3_get_autocommit (db->db_handle )));
1015
1001
}
1016
- bool Database::Deserialize (v8::Local<v8::Object> buffer,
1017
- Addon* addon,
1018
- sqlite3* db_handle,
1019
- bool readonly) {
1020
- size_t length = node::Buffer::Length (buffer);
1021
- unsigned char * data = (unsigned char *)sqlite3_malloc64 (length);
1022
- unsigned int flags =
1023
- SQLITE_DESERIALIZE_FREEONCLOSE | SQLITE_DESERIALIZE_RESIZEABLE;
1024
-
1025
- if (readonly) {
1026
- flags |= SQLITE_DESERIALIZE_READONLY;
1027
- }
1028
- if (length) {
1029
- if (!data) {
1030
- ThrowError (" Out of memory" );
1031
- return false ;
1032
- }
1033
- memcpy (data, node::Buffer::Data (buffer), length);
1034
- }
1035
-
1036
- int status =
1037
- sqlite3_deserialize (db_handle, " main" , data, length, length, flags);
1038
- if (status != SQLITE_OK) {
1039
- ThrowSqliteError (addon,
1040
- status == SQLITE_ERROR ? " unable to deserialize database"
1041
- : sqlite3_errstr (status),
1042
- status);
1043
- return false ;
1044
- }
1045
-
1046
- return true ;
1047
- }
1048
- void Database::FreeSerialization (char * data, void * _) {
1049
- sqlite3_free (data);
1050
- }
1051
1002
int const Database::MAX_BUFFER_SIZE;
1052
1003
int const Database::MAX_STRING_SIZE;
1053
1004
v8::Local<v8 ::Function> Statement::Init (v8::Isolate* isolate,
0 commit comments