1 /* Any copyright is dedicated to the Public Domain.
2 * http://creativecommons.org/licenses/publicdomain/ */
4 // Testcase for bug 365166 - crash [@ strlen] calling
5 // mozIStorageStatement::getColumnName of a statement created with
6 // "PRAGMA user_version" or "PRAGMA schema_version"
13 var colName
= param
+ "_version";
14 var sql
= "PRAGMA " + colName
;
16 var file
= Components
.classes
["@mozilla.org/file/directory_service;1"]
17 .getService(Components
.interfaces
.nsIProperties
)
18 .get("TmpD", Components
.interfaces
.nsIFile
);
19 file
.append("bug-365166.sqlite");
20 var storageService
= Components
.classes
["@mozilla.org/storage/service;1"].
21 getService(Components
.interfaces
.mozIStorageService
);
22 var conn
= storageService
.openDatabase(file
);
23 var statement
= conn
.createStatement(sql
);
25 // This shouldn't crash:
26 do_check_eq(statement
.getColumnName(0), colName
);
28 // OK, if the above statement didn't crash, check that initializing a
29 // wrapper doesn't crash either:
30 var wrapper
= Components
.classes
["@mozilla.org/storage/statement-wrapper;1"]
31 .createInstance(Components
.interfaces
.mozIStorageStatementWrapper
);
32 wrapper
.initialize(statement
);