|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 * http://creativecommons.org/licenses/publicdomain/ */ |
|
3 |
|
4 // Testcase for bug 365166 - crash [@ strlen] calling |
|
5 // mozIStorageStatement::getColumnName of a statement created with |
|
6 // "PRAGMA user_version" or "PRAGMA schema_version" |
|
7 function run_test() { |
|
8 test('user'); |
|
9 test('schema'); |
|
10 |
|
11 function test(param) |
|
12 { |
|
13 var colName = param + "_version"; |
|
14 var sql = "PRAGMA " + colName; |
|
15 |
|
16 var file = getTestDB(); |
|
17 var storageService = Components.classes["@mozilla.org/storage/service;1"]. |
|
18 getService(Components.interfaces.mozIStorageService); |
|
19 var conn = storageService.openDatabase(file); |
|
20 var statement = conn.createStatement(sql); |
|
21 try { |
|
22 // This shouldn't crash: |
|
23 do_check_eq(statement.getColumnName(0), colName); |
|
24 } finally { |
|
25 statement.reset(); |
|
26 statement.finalize(); |
|
27 } |
|
28 } |
|
29 } |