/**@class android.database.DatabaseUtils @extends java.lang.Object Static utility methods for dealing with databases and {@link android.database.Cursor}s. */ var DatabaseUtils = { /**One of the values returned by {@link #getSqlStatementType}(String). */ STATEMENT_SELECT : "1", /**One of the values returned by {@link #getSqlStatementType}(String). */ STATEMENT_UPDATE : "2", /**One of the values returned by {@link #getSqlStatementType}(String). */ STATEMENT_ATTACH : "3", /**One of the values returned by {@link #getSqlStatementType}(String). */ STATEMENT_BEGIN : "4", /**One of the values returned by {@link #getSqlStatementType}(String). */ STATEMENT_COMMIT : "5", /**One of the values returned by {@link #getSqlStatementType}(String). */ STATEMENT_ABORT : "6", /**One of the values returned by {@link #getSqlStatementType}(String). */ STATEMENT_PRAGMA : "7", /**One of the values returned by {@link #getSqlStatementType}(String). */ STATEMENT_DDL : "8", /**One of the values returned by {@link #getSqlStatementType}(String). */ STATEMENT_UNPREPARED : "9", /**One of the values returned by {@link #getSqlStatementType}(String). */ STATEMENT_OTHER : "99", /**Special function for writing an exception result at the header of a parcel, to be used when returning an exception from a transaction. exception will be re-thrown by the function in another process @param {Object {Parcel}} reply Parcel to write to @param {Object {Exception}} e The Exception to be written. @see Parcel#writeNoException @see Parcel#writeException */ writeExceptionToParcel : function( ) {}, /**Special function for reading an exception result from the header of a parcel, to be used after receiving the result of a transaction. This will throw the exception for you if it had been written to the Parcel, otherwise return and let you read the normal result data from the Parcel. @param {Object {Parcel}} reply Parcel to read from @see Parcel#writeNoException @see Parcel#readException */ readExceptionFromParcel : function( ) {}, /** */ readExceptionWithFileNotFoundExceptionFromParcel : function( ) {}, /** */ readExceptionWithOperationApplicationExceptionFromParcel : function( ) {}, /**Binds the given Object to the given SQLiteProgram using the proper typing. For example, bind numbers as longs/doubles, and everything else as a string by call toString() on it. @param {Object {SQLiteProgram}} prog the program to bind the object to @param {Number} index the 1-based index to bind at @param {Object {Object}} value the value to bind */ bindObjectToProgram : function( ) {}, /**Bind the given selection with the given selection arguments. <p> Internally assumes that '?' is only ever used for arguments, and doesn't appear as a literal or escaped value. <p> This method is typically useful for trusted code that needs to cook up a fully-bound selection. @hide */ bindSelection : function( ) {}, /**Returns data type of the given object's value. <p> Returned values are <ul> <li>{@link android.database.Cursor#FIELD_TYPE_NULL}</li> <li>{@link android.database.Cursor#FIELD_TYPE_INTEGER}</li> <li>{@link android.database.Cursor#FIELD_TYPE_FLOAT}</li> <li>{@link android.database.Cursor#FIELD_TYPE_STRING}</li> <li>{@link android.database.Cursor#FIELD_TYPE_BLOB}</li> </ul> </p> @param {Object {Object}} obj the object whose value type is to be returned @return {Number} object value type @hide */ getTypeOfObject : function( ) {}, /**Fills the specified cursor window by iterating over the contents of the cursor. The window is filled until the cursor is exhausted or the window runs out of space. The original position of the cursor is left unchanged by this operation. @param {Object {Cursor}} cursor The cursor that contains the data to put in the window. @param {Number} position The start position for filling the window. @param {Object {CursorWindow}} window The window to fill. @hide */ cursorFillWindow : function( ) {}, /**Appends an SQL string to the given StringBuilder, including the opening and closing single quotes. Any single quotes internal to sqlString will be escaped. This method is deprecated because we want to encourage everyone to use the "?" binding form. However, when implementing a ContentProvider, one may want to add WHERE clauses that were not provided by the caller. Since "?" is a positional form, using it in this case could break the caller because the indexes would be shifted to accomodate the ContentProvider's internal bindings. In that case, it may be necessary to construct a WHERE clause manually. This method is useful for those cases. @param {Object {StringBuilder}} sb the StringBuilder that the SQL string will be appended to @param {String} sqlString the raw string to be appended, which may contain single quotes */ appendEscapedSQLString : function( ) {}, /**SQL-escape a string. */ sqlEscapeString : function( ) {}, /**Appends an Object to an SQL string with the proper escaping, etc. */ appendValueToSql : function( ) {}, /**Concatenates two SQL WHERE clauses, handling empty or null values. */ concatenateWhere : function( ) {}, /**return the collation key @param {String} name @return {String} the collation key */ getCollationKey : function( ) {}, /**return the collation key in hex format @param {String} name @return {String} the collation key in hex format */ getHexCollationKey : function( ) {}, /**Prints the contents of a Cursor to System.out. The position is restored after printing. @param {Object {Cursor}} cursor the cursor to print */ dumpCursor : function( ) {}, /**Prints the contents of a Cursor to a PrintSteam. The position is restored after printing. @param {Object {Cursor}} cursor the cursor to print @param {Object {PrintStream}} stream the stream to print to */ dumpCursor : function( ) {}, /**Prints the contents of a Cursor to a StringBuilder. The position is restored after printing. @param {Object {Cursor}} cursor the cursor to print @param {Object {StringBuilder}} sb the StringBuilder to print to */ dumpCursor : function( ) {}, /**Prints the contents of a Cursor to a String. The position is restored after printing. @param {Object {Cursor}} cursor the cursor to print @return {String} a String that contains the dumped cursor */ dumpCursorToString : function( ) {}, /**Prints the contents of a Cursor's current row to System.out. @param {Object {Cursor}} cursor the cursor to print from */ dumpCurrentRow : function( ) {}, /**Prints the contents of a Cursor's current row to a PrintSteam. @param {Object {Cursor}} cursor the cursor to print @param {Object {PrintStream}} stream the stream to print to */ dumpCurrentRow : function( ) {}, /**Prints the contents of a Cursor's current row to a StringBuilder. @param {Object {Cursor}} cursor the cursor to print @param {Object {StringBuilder}} sb the StringBuilder to print to */ dumpCurrentRow : function( ) {}, /**Dump the contents of a Cursor's current row to a String. @param {Object {Cursor}} cursor the cursor to print @return {String} a String that contains the dumped cursor row */ dumpCurrentRowToString : function( ) {}, /**Reads a String out of a field in a Cursor and writes it to a Map. @param {Object {Cursor}} cursor The cursor to read from @param {String} field The TEXT field to read @param {Object {ContentValues}} values The {@link ContentValues} to put the value into, with the field as the key */ cursorStringToContentValues : function( ) {}, /**Reads a String out of a field in a Cursor and writes it to an InsertHelper. @param {Object {Cursor}} cursor The cursor to read from @param {String} field The TEXT field to read @param {Object {DatabaseUtils.InsertHelper}} inserter The InsertHelper to bind into @param {Number} index the index of the bind entry in the InsertHelper */ cursorStringToInsertHelper : function( ) {}, /**Reads a String out of a field in a Cursor and writes it to a Map. @param {Object {Cursor}} cursor The cursor to read from @param {String} field The TEXT field to read @param {Object {ContentValues}} values The {@link ContentValues} to put the value into, with the field as the key @param {String} key The key to store the value with in the map */ cursorStringToContentValues : function( ) {}, /**Reads an Integer out of a field in a Cursor and writes it to a Map. @param {Object {Cursor}} cursor The cursor to read from @param {String} field The INTEGER field to read @param {Object {ContentValues}} values The {@link ContentValues} to put the value into, with the field as the key */ cursorIntToContentValues : function( ) {}, /**Reads a Integer out of a field in a Cursor and writes it to a Map. @param {Object {Cursor}} cursor The cursor to read from @param {String} field The INTEGER field to read @param {Object {ContentValues}} values The {@link ContentValues} to put the value into, with the field as the key @param {String} key The key to store the value with in the map */ cursorIntToContentValues : function( ) {}, /**Reads a Long out of a field in a Cursor and writes it to a Map. @param {Object {Cursor}} cursor The cursor to read from @param {String} field The INTEGER field to read @param {Object {ContentValues}} values The {@link ContentValues} to put the value into, with the field as the key */ cursorLongToContentValues : function( ) {}, /**Reads a Long out of a field in a Cursor and writes it to a Map. @param {Object {Cursor}} cursor The cursor to read from @param {String} field The INTEGER field to read @param {Object {ContentValues}} values The {@link ContentValues} to put the value into @param {String} key The key to store the value with in the map */ cursorLongToContentValues : function( ) {}, /**Reads a Double out of a field in a Cursor and writes it to a Map. @param {Object {Cursor}} cursor The cursor to read from @param {String} field The REAL field to read @param {Object {ContentValues}} values The {@link ContentValues} to put the value into */ cursorDoubleToCursorValues : function( ) {}, /**Reads a Double out of a field in a Cursor and writes it to a Map. @param {Object {Cursor}} cursor The cursor to read from @param {String} field The REAL field to read @param {Object {ContentValues}} values The {@link ContentValues} to put the value into @param {String} key The key to store the value with in the map */ cursorDoubleToContentValues : function( ) {}, /**Read the entire contents of a cursor row and store them in a ContentValues. @param {Object {Cursor}} cursor the cursor to read from. @param {Object {ContentValues}} values the {@link ContentValues} to put the row into. */ cursorRowToContentValues : function( ) {}, /**Picks a start position for {@link android.database.Cursor#fillWindow} such that the window will contain the requested row and a useful range of rows around it. When the data set is too large to fit in a cursor window, seeking the cursor can become a very expensive operation since we have to run the query again when we move outside the bounds of the current window. We try to choose a start position for the cursor window such that 1/3 of the window's capacity is used to hold rows before the requested position and 2/3 of the window's capacity is used to hold rows after the requested position. @param {Number} cursorPosition The row index of the row we want to get. @param {Number} cursorWindowCapacity The estimated number of rows that can fit in a cursor window, or 0 if unknown. @return {Number} The recommended start position, always less than or equal to the requested row. @hide */ cursorPickFillWindowStartPosition : function( ) {}, /**Query the table for the number of rows in the table. @param {Object {SQLiteDatabase}} db the database the table is in @param {String} table the name of the table to query @return {Number} the number of rows in the table */ queryNumEntries : function( ) {}, /**Query the table for the number of rows in the table. @param {Object {SQLiteDatabase}} db the database the table is in @param {String} table the name of the table to query @param {String} selection A filter declaring which rows to return, formatted as an SQL WHERE clause (excluding the WHERE itself). Passing null will count all rows for the given table @return {Number} the number of rows in the table filtered by the selection */ queryNumEntries : function( ) {}, /**Query the table for the number of rows in the table. @param {Object {SQLiteDatabase}} db the database the table is in @param {String} table the name of the table to query @param {String} selection A filter declaring which rows to return, formatted as an SQL WHERE clause (excluding the WHERE itself). Passing null will count all rows for the given table @param {Object {java.lang.String[]}} selectionArgs You may include ?s in selection, which will be replaced by the values from selectionArgs, in order that they appear in the selection. The values will be bound as Strings. @return {Number} the number of rows in the table filtered by the selection */ queryNumEntries : function( ) {}, /**Query the table to check whether a table is empty or not @param {Object {SQLiteDatabase}} db the database the table is in @param {String} table the name of the table to query @return {Boolean} True if the table is empty @hide */ queryIsEmpty : function( ) {}, /**Utility method to run the query on the db and return the value in the first column of the first row. */ longForQuery : function( ) {}, /**Utility method to run the pre-compiled query and return the value in the first column of the first row. */ longForQuery : function( ) {}, /**Utility method to run the query on the db and return the value in the first column of the first row. */ stringForQuery : function( ) {}, /**Utility method to run the pre-compiled query and return the value in the first column of the first row. */ stringForQuery : function( ) {}, /**Utility method to run the query on the db and return the blob value in the first column of the first row. @return {Object {android.os.ParcelFileDescriptor}} A read-only file descriptor for a copy of the blob value. */ blobFileDescriptorForQuery : function( ) {}, /**Utility method to run the pre-compiled query and return the blob value in the first column of the first row. @return {Object {android.os.ParcelFileDescriptor}} A read-only file descriptor for a copy of the blob value. */ blobFileDescriptorForQuery : function( ) {}, /**Reads a String out of a column in a Cursor and writes it to a ContentValues. Adds nothing to the ContentValues if the column isn't present or if its value is null. @param {Object {Cursor}} cursor The cursor to read from @param {Object {ContentValues}} column The column to read @param {String} values The {@link ContentValues} to put the value into */ cursorStringToContentValuesIfPresent : function( ) {}, /**Reads a Long out of a column in a Cursor and writes it to a ContentValues. Adds nothing to the ContentValues if the column isn't present or if its value is null. @param {Object {Cursor}} cursor The cursor to read from @param {Object {ContentValues}} column The column to read @param {String} values The {@link ContentValues} to put the value into */ cursorLongToContentValuesIfPresent : function( ) {}, /**Reads a Short out of a column in a Cursor and writes it to a ContentValues. Adds nothing to the ContentValues if the column isn't present or if its value is null. @param {Object {Cursor}} cursor The cursor to read from @param {Object {ContentValues}} column The column to read @param {String} values The {@link ContentValues} to put the value into */ cursorShortToContentValuesIfPresent : function( ) {}, /**Reads a Integer out of a column in a Cursor and writes it to a ContentValues. Adds nothing to the ContentValues if the column isn't present or if its value is null. @param {Object {Cursor}} cursor The cursor to read from @param {Object {ContentValues}} column The column to read @param {String} values The {@link ContentValues} to put the value into */ cursorIntToContentValuesIfPresent : function( ) {}, /**Reads a Float out of a column in a Cursor and writes it to a ContentValues. Adds nothing to the ContentValues if the column isn't present or if its value is null. @param {Object {Cursor}} cursor The cursor to read from @param {Object {ContentValues}} column The column to read @param {String} values The {@link ContentValues} to put the value into */ cursorFloatToContentValuesIfPresent : function( ) {}, /**Reads a Double out of a column in a Cursor and writes it to a ContentValues. Adds nothing to the ContentValues if the column isn't present or if its value is null. @param {Object {Cursor}} cursor The cursor to read from @param {Object {ContentValues}} column The column to read @param {String} values The {@link ContentValues} to put the value into */ cursorDoubleToContentValuesIfPresent : function( ) {}, /**Creates a db and populates it with the sql statements in sqlStatements. @param {Object {Context}} context the context to use to create the db @param {String} dbName the name of the db to create @param {Number} dbVersion the version to set on the db @param {String} sqlStatements the statements to use to populate the db. This should be a single string of the form returned by sqlite3's <tt>.dump</tt> command (statements separated by semicolons) */ createDbFromSqlStatements : function( ) {}, /**Returns one of the following which represent the type of the given SQL statement. <ol> <li>{@link #STATEMENT_SELECT}</li> <li>{@link #STATEMENT_UPDATE}</li> <li>{@link #STATEMENT_ATTACH}</li> <li>{@link #STATEMENT_BEGIN}</li> <li>{@link #STATEMENT_COMMIT}</li> <li>{@link #STATEMENT_ABORT}</li> <li>{@link #STATEMENT_OTHER}</li> </ol> @param {String} sql the SQL statement whose type is returned by this method @return {Number} one of the values listed above */ getSqlStatementType : function( ) {}, /**Appends one set of selection args to another. This is useful when adding a selection argument to a user provided set. */ appendSelectionArgs : function( ) {}, /**Returns column index of "_id" column, or -1 if not found. @hide */ findRowIdColumnIndex : function( ) {}, };