Closed Bug 531462 Opened 15 years ago Closed 15 years ago

mozIStorageStatement's getParameterIndex changed behavior between 3.5 and 3.6

Categories

(Toolkit :: Storage, defect)

All
macOS
defect
Not set
major

Tracking

()

VERIFIED DUPLICATE of bug 528166

People

(Reporter: electronic, Unassigned)

Details

User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5
Build Identifier: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 AND Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2b4) Gecko/20091124 Firefox/3.6b4

It seems that mozIStorageStatement's getParameterIndex's behaviors changed slightly, which is messing me up considerably.

For a SQL statement "select id,time,data from table where id = :id", in pre FF3.6, you would have to call getParameterIndex with colons in front of parameter names (e.g., ":id"); omitting them would result in an exception, but in 3.6 this has switched:

Firefox 3.5.x:
statement.getParameterIndex(":id") => 0
statement.getParameterIndex("id") => Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [mozIStorageStatement.getParameterIndex]

Firefox 3.6.x:
statement.getParameterIndex(":id") => Component returned failure code: 0x80070057 (NS_ERROR_ILLEGAL_VALUE) [mozIStorageStatement.getParameterIndex]
statement.getParameterIndex("id") => 0

Help. This sucks. 


Reproducible: Always

Steps to Reproduce:
Open a database, create a statement with a named parameter, call getParameterIndex.
This was done in bug 490833.
Assignee: Jan.Varga → nobody
Status: UNCONFIRMED → RESOLVED
Closed: 15 years ago
Component: SQL → Storage
Product: Core → Toolkit
QA Contact: irixman+bugzilla → storage
Resolution: --- → DUPLICATE
Using the statement wrapper [1] works in 3.5 and 3.6 and you don't have to worry about any incompatibilities between the two.  Just do:
statement.params.id = ValueYouWantToBind;
and that will work in both versions.

[1] https://developer.mozilla.org/en/mozIStorageStatementWrapper
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.