Add a way to get the name of a column in a row

NEW
Unassigned

Status

()

Toolkit
Storage
P3
normal
2 years ago
4 months ago

People

(Reporter: lina, Unassigned)

Tracking

(Depends on: 1 bug)

Firefox Tracking Flags

(Not tracked)

Details

MozReview Requests

()

Submitter Diff Changes Open Issues Last Updated
Loading...
Error loading review requests:

Attachments

(1 attachment)

(Reporter)

Description

2 years ago
Earlier, I wanted to dump a table's contents for debugging, similar to http://searchfox.org/mozilla-central/rev/51aa673e28802fe6ea89f4793721fc55334a6ac8/toolkit/components/places/tests/head_common.js#243-289.

It looks like I can get the column names using `mozIStorageStatement.getColumnName`, but, AFAICT, that's only implemented for synchronous statements. I'm also using Sqlite.jsm, which only exposes `mozIStorageRow` objects.

I could open a synchronous DB connection and dump the table that way. Since rows already store the column names, though, I thought it would make sense to add a `getColumnName` method to `mozIStorageRow`. It's only really useful for debugging, but I'm submitting a patch with a basic test in case it's useful.
Comment hidden (mozreview-request)
off-hand, it would be much better if we'd have bug 512761, then you could probably just use common javascript syntax to get the keys, rather than adding further API complication to mozIStorageRow. So, if you'd have any time and ideas to complete that patch instead, that'd be very welcome.
In the lack of that, your request is understandable and we can probably take this.
(Reporter)

Comment 3

2 years ago
Comment on attachment 8822911 [details]
Bug 1326565 - Add `mozIStorageRow.getColumnName`.

(In reply to Marco Bonardo [::mak] from comment #2)
> off-hand, it would be much better if we'd have bug 512761, then you could
> probably just use common javascript syntax to get the keys, rather than
> adding further API complication to mozIStorageRow.

Interesting, thanks for the pointer! I'm on PTO this week, but I'll have a look at Shawn's patch on bug 512761 when I get back. Clearing review in the meantime.
Attachment #8822911 - Flags: review?(mak77)
Depends on: 512761
Priority: -- → P3
(Reporter)

Comment 4

4 months ago
I'm not likely to get back to untangling the XPConnect magic in bug 512761 soon, so unassigning myself for now, sorry.
Assignee: kit → nobody
Status: ASSIGNED → NEW
You need to log in before you can comment on or make changes to this bug.