B2G/gecko/storage/test/unit/test_locale_collation.js
/**
 * Creates a test database similar to the default one created in
 * head_storage.js, except that this one uses UTF-16 encoding.
 *
 * @return A connection to the database.
 */
Creates a test database similar to the default one created in
head_storage.js, except that this one uses UTF-16 encoding.

@return A connection to the database.
Creates a test database similar to the default one created in head_storage . js except that this one uses UTF - 16 encoding . @return A connection to the database .
function createUtf16Database()
{
  print("Creating the in-memory UTF-16-encoded database.");
  let conn = getService().openSpecialDatabase("memory");
  conn.executeSimpleSQL("PRAGMA encoding = 'UTF-16'");
  print("Make sure the encoding was set correctly and is now UTF-16.");
  let stmt = conn.createStatement("PRAGMA encoding");
  do_check_true(stmt.executeStep());
  let enc = stmt.getString(0);
  stmt.finalize();
  do_check_true(enc === "UTF-16le" || enc === "UTF-16be");
  return conn;
}
function createUtf16Database ( ) { print ( "Creating the in-memory UTF-16-encoded database." ) ; let conn = getService ( ) . openSpecialDatabase ( "memory" ) ; conn . executeSimpleSQL ( "PRAGMA encoding = 'UTF-16'" ) ; print ( "Make sure the encoding was set correctly and is now UTF-16." ) ; let stmt = conn . createStatement ( "PRAGMA encoding" ) ; do_check_true ( stmt . executeStep ( ) ) ; let enc = stmt . getString ( 0 ) ; stmt . finalize ( ) ; do_check_true ( enc === "UTF-16le" || enc === "UTF-16be" ) ; return conn ; }
Creates a test database similar to the default one created in
 head_storage.js, except that this one uses UTF-16 encoding.
Creates a test database similar to the default one created in head_storage . js except that this one uses UTF - 16 encoding .
// The value returned will actually be UTF-16le or UTF-16be.