Closed Bug 483318 Opened 17 years ago Closed 1 year ago

mozIStorageStatementParams doesn't let you bind an array

Categories

(Core :: SQLite and Embedded Database Bindings, defect, P3)

defect

Tracking

()

RESOLVED FIXED
134 Branch
Tracking Status
firefox134 --- fixed

People

(Reporter: sdwilsh, Assigned: mak)

References

(Blocks 3 open bugs, )

Details

Attachments

(2 files, 2 obsolete files)

And we really should be able to bind an array of ints, which is how we return binary blobs anyway.
Flags: in-testsuite?
bindBlobParameter() works fine, but i notice it's deprecated..
(In reply to comment #1) > bindBlobParameter() works fine, but i notice it's deprecated.. bindBlobByName or bindBlobByIndex have replaced it.
Priority: -- → P3
Depends on: 1336944
We could use https://www.sqlite.org/carray.html but we should be careful, the provided query should never allow an user provided argument, we should only support it through Storage API. Note: I'm not sure which part of the carray syntax, if any, can be bound, I'm assuming its arguments can, so the idea currently is: parse queries for "carray" and throw if the any of its 2 arguments is not bound. Sqlite.jsm may also allow something like "IN :myarray" or "IN ?" and just do a string replacement internally, while cpp API may only support a straight carray(?,?) or carray(:myarray, :mylen).
Blocks: 1336943
Blocks: 1047818
Severity: normal → S3
Blocks: 1339390
Product: Toolkit → Core
Blocks: 1594368

Depends on D221264

Assignee: nobody → mak
Status: NEW → ASSIGNED

Use carray`` extension to bind array of numerics and strings, so we can avoid large and slow IN clauses, and cache prepared statements having a variable number of parameters. The extension is statically loaded and available in every connection. Consumers are encouraged to use the explicit bindArrayXXXmethods, as the genericbindByIndexandbindByNamemethods are too lenient, especially from Javascript. Notecarray`` only supports UTF8 encoded strings, the API will convert
the encoding when UTF16 is passed in.
These new variants are not exposed to Rust yet, as the existing comment
suggests they were intended for primitive types. It could be done in the
future, if necessary.

Attachment #9423044 - Attachment is obsolete: true
Attachment #9423043 - Attachment is obsolete: true
Blocks: 1924124
Pushed by mak77@bonardo.net: https://hg.mozilla.org/integration/autoland/rev/507b979e3c93 Vendor SQLite carray extension and load it automatically. r=asuth,lina,glandium https://hg.mozilla.org/integration/autoland/rev/d23ddf67f8a4 Implement binding arrays to mozIStorageStatementParams. r=asuth,lina,Standard8

Backed out for causing multiple failures.

Flags: needinfo?(mak)

The gtest failure is funny, it is actually caused by a previous test that is calling sqlite3_shutdown() and then it tries to reinitialize the library, but it doesn't use the same options that were originally used to initialize it.
So the solution is to expose an Init() method from AutoSQLiteLifetime and use that to reinitialize.

Flags: needinfo?(mak)
Pushed by mak77@bonardo.net: https://hg.mozilla.org/integration/autoland/rev/8c03fc306baf Vendor SQLite carray extension and load it automatically. r=asuth,lina,glandium https://hg.mozilla.org/integration/autoland/rev/7884cf6b09a9 Implement binding arrays to mozIStorageStatementParams. r=asuth,lina,Standard8
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 134 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: