2
2
//
3
3
4
4
#include " better_sqlite3.hpp"
5
+ #line 39 "./src/util/binder.lzz"
6
+ static bool IsPlainObject (v8::Isolate* isolate, v8::Local<v8::Object> obj) {
7
+ v8::Local<v8::Value> proto = obj->GetPrototype ();
8
+
9
+ #if defined NODE_MODULE_VERSION && NODE_MODULE_VERSION < 93
10
+ v8::Local<v8::Context> ctx = obj->CreationContext ();
11
+ #else
12
+ v8::Local<v8::Context> ctx = obj->GetCreationContext ().ToLocalChecked ();
13
+ #endif
14
+
15
+ ctx->Enter ();
16
+ v8::Local<v8::Value> baseProto = v8::Object::New (isolate)->GetPrototype ();
17
+ ctx->Exit ();
18
+ return proto->StrictEquals (baseProto) || proto->StrictEquals (v8::Null (isolate));
19
+ }
5
20
#line 67 "./src/better_sqlite3.lzz"
6
21
NODE_MODULE_INIT (/* exports, context */ ) {
7
22
v8::Isolate* isolate = context->GetIsolate ();
@@ -104,8 +119,7 @@ void SetPrototypeGetter (v8::Isolate * isolate, v8::Local <v8::External> data, v
104
119
0 ,
105
120
data,
106
121
v8::AccessControl::DEFAULT,
107
- v8::PropertyAttribute::None,
108
- v8::AccessorSignature::New (isolate, recv)
122
+ v8::PropertyAttribute::None
109
123
);
110
124
}
111
125
#line 4 "./src/util/constants.lzz"
@@ -1951,37 +1965,26 @@ bool Binder::Bind (v8::FunctionCallbackInfo <v8 :: Value> const & info, int argc
1951
1965
}
1952
1966
return success;
1953
1967
}
1954
- #line 35 "./src/util/binder.lzz"
1955
- bool Binder::IsPlainObject (v8::Isolate * isolate, v8::Local <v8::Object> obj)
1956
- #line 35 "./src/util/binder.lzz"
1957
- {
1958
- v8::Local<v8::Value> proto = obj->GetPrototype ();
1959
- v8::Local<v8::Context> ctx = obj->CreationContext ();
1960
- ctx->Enter ();
1961
- v8::Local<v8::Value> baseProto = v8::Object::New (isolate)->GetPrototype ();
1962
- ctx->Exit ();
1963
- return proto->StrictEquals (baseProto) || proto->StrictEquals (v8::Null (isolate));
1964
- }
1965
- #line 44 "./src/util/binder.lzz"
1968
+ #line 54 "./src/util/binder.lzz"
1966
1969
void Binder::Fail (void (* Throw) (char const *), char const * message)
1967
- #line 44 "./src/util/binder.lzz"
1970
+ #line 54 "./src/util/binder.lzz"
1968
1971
{
1969
1972
assert (success == true );
1970
1973
assert ((Throw == NULL ) == (message == NULL ));
1971
1974
assert (Throw == ThrowError || Throw == ThrowTypeError || Throw == ThrowRangeError || Throw == NULL );
1972
1975
if (Throw) Throw (message);
1973
1976
success = false ;
1974
1977
}
1975
- #line 52 "./src/util/binder.lzz"
1978
+ #line 62 "./src/util/binder.lzz"
1976
1979
int Binder::NextAnonIndex ()
1977
- #line 52 "./src/util/binder.lzz"
1980
+ #line 62 "./src/util/binder.lzz"
1978
1981
{
1979
1982
while (sqlite3_bind_parameter_name (handle, ++anon_index) != NULL ) {}
1980
1983
return anon_index;
1981
1984
}
1982
- #line 58 "./src/util/binder.lzz"
1985
+ #line 68 "./src/util/binder.lzz"
1983
1986
void Binder::BindValue (v8::Isolate * isolate, v8::Local <v8::Value> value, int index)
1984
- #line 58 "./src/util/binder.lzz"
1987
+ #line 68 "./src/util/binder.lzz"
1985
1988
{
1986
1989
int status = Data::BindValueFromJS (isolate, handle, index, value);
1987
1990
if (status != SQLITE_OK) {
@@ -2000,9 +2003,9 @@ void Binder::BindValue (v8::Isolate * isolate, v8::Local <v8::Value> value, int
2000
2003
assert (false );
2001
2004
}
2002
2005
}
2003
- #line 79 "./src/util/binder.lzz"
2006
+ #line 89 "./src/util/binder.lzz"
2004
2007
int Binder::BindArray (v8::Isolate * isolate, v8::Local <v8::Array> arr)
2005
- #line 79 "./src/util/binder.lzz"
2008
+ #line 89 "./src/util/binder.lzz"
2006
2009
{
2007
2010
v8 :: Local < v8 :: Context > ctx = isolate -> GetCurrentContext ( ) ;
2008
2011
uint32_t length = arr->Length ();
@@ -2024,9 +2027,9 @@ int Binder::BindArray (v8::Isolate * isolate, v8::Local <v8::Array> arr)
2024
2027
}
2025
2028
return len;
2026
2029
}
2027
- #line 105 "./src/util/binder.lzz"
2030
+ #line 115 "./src/util/binder.lzz"
2028
2031
int Binder::BindObject (v8::Isolate * isolate, v8::Local <v8::Object> obj, Statement * stmt)
2029
- #line 105 "./src/util/binder.lzz"
2032
+ #line 115 "./src/util/binder.lzz"
2030
2033
{
2031
2034
v8 :: Local < v8 :: Context > ctx = isolate -> GetCurrentContext ( ) ;
2032
2035
BindMap* bind_map = stmt->GetBindMap (isolate);
@@ -2063,9 +2066,9 @@ int Binder::BindObject (v8::Isolate * isolate, v8::Local <v8::Object> obj, State
2063
2066
2064
2067
return len;
2065
2068
}
2066
- #line 149 "./src/util/binder.lzz"
2069
+ #line 159 "./src/util/binder.lzz"
2067
2070
Binder::Result Binder::BindArgs (v8::FunctionCallbackInfo <v8 :: Value> const & info, int argc, Statement * stmt)
2068
- #line 149 "./src/util/binder.lzz"
2071
+ #line 159 "./src/util/binder.lzz"
2069
2072
{
2070
2073
v8 :: Isolate * isolate = info . GetIsolate ( ) ;
2071
2074
int count = 0 ;
0 commit comments