-
Notifications
You must be signed in to change notification settings - Fork 30.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sqlite: support ArrayBuffer and TypedArray in StatementSync
#56385
base: main
Are you sure you want to change the base?
Conversation
79ca6ef
to
aa1218f
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #56385 +/- ##
=======================================
Coverage 88.53% 88.54%
=======================================
Files 657 657
Lines 190689 190691 +2
Branches 36597 36598 +1
=======================================
+ Hits 168826 168842 +16
+ Misses 15030 15025 -5
+ Partials 6833 6824 -9
|
@@ -1035,7 +1036,8 @@ bool StatementSync::BindValue(const Local<Value>& value, const int index) { | |||
statement_, index, *val, val.length(), SQLITE_TRANSIENT); | |||
} else if (value->IsNull()) { | |||
r = sqlite3_bind_null(statement_, index); | |||
} else if (value->IsUint8Array()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no arraybuffer view?
@@ -930,7 +930,8 @@ bool StatementSync::BindParams(const FunctionCallbackInfo<Value>& args) { | |||
int anon_idx = 1; | |||
int anon_start = 0; | |||
|
|||
if (args[0]->IsObject() && !args[0]->IsUint8Array()) { | |||
if (args[0]->IsObject() && !args[0]->IsUint8Array() && | |||
!args[0]->IsTypedArray() && !args[0]->IsArrayBuffer()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using IsArrayBufferView()
here is likely a lot better than separate IsUint8Array()
and IsTypedArray()
checks.
} | ||
|
||
const arrayBuffer = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8]).buffer; | ||
const TypedArrays = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should DataView
also be supported?
} else if (value->IsUint8Array() || value->IsArrayBufferView() || | ||
value->IsArrayBuffer()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Uint8Array
s are BufferView
s
} else if (value->IsUint8Array() || value->IsArrayBufferView() || | |
value->IsArrayBuffer()) { | |
} else if (value->IsArrayBufferView() || value->IsArrayBuffer()) { |
Fixes: #56384