Closed Bug 272974 Opened 20 years ago Closed 20 years ago

nice scriptable wrappers for storage

Categories

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

x86
All
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: vlad, Assigned: vlad)

Details

Attachments

(1 file)

Attached patch implements some nice scriptable wrappers for storage, allowing
for stuff like:

 var stmt = dbconn.createStatement(sql);
 var wrapper =
Components.classes["@mozilla.org/storage/statement-wrapper;1"].createInstance(Components.interfaces.mozIStorageStatementWrapper);
 wrapper.initialize(stmt)

 wrapper(1, 2, 3);   // call wrapper function with 1,2,3 args
 while (wrapper.step()) {
   dump(wrapper.row.columnA);
   dump(wrapper.row.columnB);
 }

 wrapper.params[0] = 1;
 wrapper.params[1] = 2;
 while (wrapper.step()) {
   ...
 }
Note that this patch will allow us to split out this wrapper from the rest of
storage, ensuring that the core storage interface has no dependency on
js/xpconnect.  Some file reorg will need to happen for that, so punting on that
until later.
Comment on attachment 167740 [details] [diff] [review]
272974-scriptable-storage-0.patch

r=shaver with fixes to f2f-review comments.
Attachment #167740 - Flags: first-review?(shaver) → first-review+
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
quick comment: snprintf should be PR_snprintf for portability.
(In reply to comment #3)
> quick comment: snprintf should be PR_snprintf for portability.

or PR_smprintf, then you don't need to do that length calculation yourself
Flags: in-testsuite?
Product: Toolkit → Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: