Info Call to SQLite query API

Description

Improper SQL query construction could lead to SQL injection. An SQL injection attack consists of injecting of an SQL query via the input data from the client to the application

Recommendation

This entry is informative, no recommendations applicable.

Technical details

Method com.microsoft.appcenter.utils.storage.DatabaseManager.getCursor() calling method android.database.sqlite.SQLiteQueryBuilder.appendWhere()


    android.database.Cursor getCursor(String p9, Object p10, boolean p11)
    {
        String[] v4;
        android.database.sqlite.SQLiteQueryBuilder v0 = com.microsoft.appcenter.utils.storage.SQLiteUtils.newSQLiteQueryBuilder();
        v0.setTables(this.mTable);
        if (p9 != null) {
            if (p10 != null) {
                v0.appendWhere(new StringBuilder().append(p9).append(" = ?").toString());
                v4 = new String[1];
                v4[0] = String.valueOf(p10.toString());
            } else {
                v0.appendWhere(new StringBuilder().append(p9).append(" IS NULL").toString());
                v4 = 0;
            }
        } else {
            v4 = 0;
        }
        int v2;
        if (!p11) {
            v2 = 0;
        } else {
            v2 = new String[1];
            v2[0] = "oid";
        }
        return v0.query(this.getDatabase(), v2, 0, v4, 0, 0, "oid");
    }

Method com.microsoft.appcenter.utils.storage.DatabaseManager.getCursor() calling method android.database.sqlite.SQLiteQueryBuilder.query()


    android.database.Cursor getCursor(String p9, Object p10, boolean p11)
    {
        String[] v4;
        android.database.sqlite.SQLiteQueryBuilder v0 = com.microsoft.appcenter.utils.storage.SQLiteUtils.newSQLiteQueryBuilder();
        v0.setTables(this.mTable);
        if (p9 != null) {
            if (p10 != null) {
                v0.appendWhere(new StringBuilder().append(p9).append(" = ?").toString());
                v4 = new String[1];
                v4[0] = String.valueOf(p10.toString());
            } else {
                v0.appendWhere(new StringBuilder().append(p9).append(" IS NULL").toString());
                v4 = 0;
            }
        } else {
            v4 = 0;
        }
        int v2;
        if (!p11) {
            v2 = 0;
        } else {
            v2 = new String[1];
            v2[0] = "oid";
        }
        return v0.query(this.getDatabase(), v2, 0, v4, 0, 0, "oid");
    }

Method com.microsoft.appcenter.utils.storage.DatabaseManager.update() calling method android.database.sqlite.SQLiteDatabase.update()


    public boolean update(long p12, android.content.ContentValues p14)
    {
        int v2 = 1;
        if (this.mIMDB != null) {
            android.content.ContentValues v1_1 = ((android.content.ContentValues) this.mIMDB.get(Long.valueOf(p12)));
            if (v1_1 != null) {
                v1_1.putAll(p14);
            } else {
                v2 = 0;
            }
        } else {
            try {
                String v4_4 = this.getDatabase();
                Long v5_1 = this.mTable;
                String[] v7_1 = new String[1];
                v7_1[0] = String.valueOf(p12);
            } catch (RuntimeException v0) {
                this.switchToInMemory("update", v0);
            }
            if (v4_4.update(v5_1, p14, "oid = ?", v7_1) <= 0) {
                v2 = 0;
            }
        }
        return v2;
    }

Method com.adobe.mobile.AnalyticsWorker.updateHitInDatabase() calling method android.database.sqlite.SQLiteDatabase.update()


    protected void updateHitInDatabase(com.adobe.mobile.AbstractHitDatabase$Hit p8)
    {
        try {
            android.content.ContentValues v1_1 = new android.content.ContentValues();
            v1_1.put("URL", p8.urlFragment);
            this.database.update("HITS", v1_1, new StringBuilder().append("id=").append(p8.identifier).toString(), 0);
        } catch (String v2_3) {
            throw v2_3;
        } catch (Exception v0_0) {
            Object[] v4_1 = new Object[1];
            v4_1[0] = v0_0.getMessage();
            com.adobe.mobile.StaticMethods.logErrorFormat("Analytics - Unknown error updating url in database (%s)", v4_1);
        }
        return;
    }

Method com.adobe.mobile.AnalyticsTrackTimedAction.trackTimedActionExists() calling method android.database.sqlite.SQLiteDatabase.rawQuery()


    protected boolean trackTimedActionExists(String p11)
    {
        int v4_0 = 0;
        if ((p11 != null) && (p11.trim().length() != 0)) {
            int v2 = 0;
            try {
                if (this.database != null) {
                    try {
                        int v6_1 = this.database;
                        String v7_0 = this.sqlExistsAction;
                        String[] v8_1 = new String[1];
                        v8_1[0] = p11;
                        android.database.Cursor v0 = v6_1.rawQuery(v7_0, v8_1);
                    } catch (Exception v1_0) {
                        int v4_2 = new Object[2];
                        v4_2[0] = this.logPrefix;
                        v4_2[1] = v1_0.getMessage();
                        com.adobe.mobile.StaticMethods.logErrorFormat("%s - Unknown error checking for timed action (%s)", v4_2);
                        v4_0 = v2;
                    }
                    if (v0.moveToFirst()) {
                        if (v0.getInt(0) <= 0) {
                            v2 = 0;
                        } else {
                            v2 = 1;
                        }
                    }
                    v0.close();
                } else {
                }
            } catch (String v3_3) {
                throw v3_3;
            }
        } else {
            String v3_4 = new Object[1];
            v3_4[0] = this.logPrefix;
            com.adobe.mobile.StaticMethods.logWarningFormat("%s - Unable to verify the existence of timed action (timed action name was null or empty)", v3_4);
        }
        return v4_0;
    }

Method com.adobe.mobile.AnalyticsTrackTimedAction.saveContextDataForTimedAction() calling method android.database.sqlite.SQLiteDatabase.rawQuery()


    private void saveContextDataForTimedAction(String p15, java.util.Map p16)
    {
        if ((p15 != null) && (p15.trim().length() != 0)) {
            if ((p16 != null) && (!p16.isEmpty())) {
                try {
                    if (this.database != null) {
                        android.database.sqlite.SQLiteStatement v7_9 = this.database;
                        Object[] v9_4 = this.sqlSelectAction;
                        Object[] v10_8 = new String[1];
                        v10_8[0] = p15;
                        android.database.Cursor v1_0 = v7_9.rawQuery(v9_4, v10_8);
                        if (!v1_0.moveToFirst()) {
                            v1_0.close();
                            Object[] v9_8 = new Object[1];
                            v9_8[0] = p15;
                            com.adobe.mobile.StaticMethods.logWarningFormat("Analytics - Unable to save context data (no timed action was found matching the name %s)", v9_8);
                        } else {
                            int v5 = v1_0.getInt(0);
                            v1_0.close();
                            Object[] v9_9 = p16.entrySet().iterator();
                            while (v9_9.hasNext()) {
                                java.util.Map$Entry v3_1 = ((java.util.Map$Entry) v9_9.next());
                                String v4_1 = ((String) v3_1.getKey());
                                Object v6 = v3_1.getValue();
                                if ((v4_1 != null) && (v4_1.length() > 0)) {
                                    String v0;
                                    Object[] v10_10 = this.database;
                                    int v11_5 = this.sqlExistsContextDataByActionAndKey;
                                    long v12_1 = new String[2];
                                    v12_1[0] = String.valueOf(v5);
                                    v12_1[1] = ((String) v3_1.getKey());
                                    android.database.Cursor v1_1 = v10_10.rawQuery(v11_5, v12_1);
                                    if (v6 != null) {
                                        v0 = v6.toString();
                                    } else {
                                        v0 = "";
                                    }
                                    if ((!v1_1.moveToFirst()) || (v1_1.getInt(0) <= 0)) {
                                        this.sqlInsertContextData.bindLong(1, ((long) v5));
                                        this.sqlInsertContextData.bindString(2, ((String) v3_1.getKey()));
                                        this.sqlInsertContextData.bindString(3, v0);
                                        if (this.sqlInsertContextData.executeInsert() == -1) {
                                            Object[] v10_1 = new Object[1];
                                            v10_1[0] = p15;
                                            com.adobe.mobile.StaticMethods.logWarningFormat("Analytics - Unable to insert the timed action\'s context data (%s)", v10_1);
                                        }
                                        this.sqlInsertContextData.clearBindings();
                                    } else {
                                        this.sqlUpdateContextData.bindString(1, v0);
                                        this.sqlUpdateContextData.bindLong(2, ((long) v5));
                                        this.sqlUpdateContextData.bindString(3, ((String) v3_1.getKey()));
                                        this.sqlUpdateContextData.execute();
                                        this.sqlUpdateContextData.clearBindings();
                                    }
                                    v1_1.close();
                                }
                            }
                        }
                    } else {
                        Object[] v9_1 = new Object[0];
                        com.adobe.mobile.StaticMethods.logErrorFormat("Analytics - Null Database Object, unable to save context data for timed action", v9_1);
                    }
                } catch (android.database.sqlite.SQLiteStatement v7_12) {
                    throw v7_12;
                } catch (Exception v2_1) {
                    Object[] v9_6 = new Object[1];
                    v9_6[0] = v2_1.getMessage();
                    com.adobe.mobile.StaticMethods.logErrorFormat("Analytics - SQL exception when attempting to update context data for timed action (%s)", v9_6);
                } catch (Exception v2_0) {
                    Object[] v9_3 = new Object[1];
                    v9_3[0] = v2_0.getMessage();
                    com.adobe.mobile.StaticMethods.logErrorFormat("Analytics - Unexpected exception when attempting to update context data for timed action (%s)", v9_3);
                }
            } else {
                Object v8_1 = new Object[0];
                com.adobe.mobile.StaticMethods.logWarningFormat("Analytics - Unable to save context data (context data was null or empty)", v8_1);
            }
        } else {
            Object v8_3 = new Object[0];
            com.adobe.mobile.StaticMethods.logWarningFormat("Analytics - Unable to save context data (timed action name was null or empty)", v8_3);
        }
        return;
    }

Method com.adobe.mobile.AnalyticsTrackTimedAction.getTimedAction() calling method android.database.sqlite.SQLiteDatabase.rawQuery()


    private com.adobe.mobile.AnalyticsTimedAction getTimedAction(String p13)
    {
        int v0_0 = 0;
        if ((p13 != null) && (p13.trim().length() != 0)) {
            try {
                if (this.database != null) {
                    boolean v1_1 = this.database;
                    String v2_1 = this.sqlSelectAction;
                    String v3_1 = new String[1];
                    v3_1[0] = p13;
                    android.database.Cursor v7 = v1_1.rawQuery(v2_1, v3_1);
                    try {
                        if (!v7.moveToFirst()) {
                            v0_0 = 0;
                        } else {
                            v0_0 = new com.adobe.mobile.AnalyticsTimedAction(0, v7.getLong(1), v7.getLong(2), v7.getInt(0));
                            boolean v1_6 = this.database;
                            String v2_4 = this.sqlSelectContextDataForAction;
                            String v3_3 = new String[1];
                            v3_3[0] = String.valueOf(v0_0.databaseID);
                            android.database.Cursor v8 = v1_6.rawQuery(v2_4, v3_3);
                            if (v8.moveToFirst()) {
                                v0_0.contextData = new java.util.HashMap();
                                do {
                                    v0_0.contextData.put(v8.getString(0), v8.getString(1));
                                } while(v8.moveToNext());
                            }
                            v8.close();
                        }
                    } catch (Exception v9_1) {
                        String v2_10 = new Object[1];
                        v2_10[0] = v9_1.getMessage();
                        com.adobe.mobile.StaticMethods.logErrorFormat("Analytics - Unable to read from timed actions database (%s)", v2_10);
                        this.resetDatabase(v9_1);
                        return v0_0;
                    } catch (Exception v9_0) {
                        String v2_8 = new Object[1];
                        v2_8[0] = v9_0.getMessage();
                        com.adobe.mobile.StaticMethods.logErrorFormat("Analytics - Unknown error reading from timed actions database (%s)", v2_8);
                    }
                    v7.close();
                }
            } catch (boolean v1_5) {
            }
            throw v1_5;
        } else {
            String v2_11 = new Object[0];
            com.adobe.mobile.StaticMethods.logWarningFormat("Analytics - Unable to get timed action (timed action name was null or empty)", v2_11);
        }
        return v0_0;
    }

Method com.adobe.mobile.AbstractDatabaseBacking.openOrCreateDatabase() calling method android.database.sqlite.SQLiteDatabase.openDatabase()


    private void openOrCreateDatabase()
    {
        try {
            this.closeDataBase();
            this.database = android.database.sqlite.SQLiteDatabase.openDatabase(this._dbFile.getPath(), 0, 268435472);
            this.databaseStatus = com.adobe.mobile.AbstractDatabaseBacking$DatabaseStatus.OK;
        } catch (android.database.SQLException v1) {
            this.databaseStatus = com.adobe.mobile.AbstractDatabaseBacking$DatabaseStatus.FATALERROR;
            Object[] v3_1 = new Object[2];
            v3_1[0] = this.logPrefix;
            v3_1[1] = v1.getLocalizedMessage();
            com.adobe.mobile.StaticMethods.logErrorFormat("%s - Unable to open database (%s).", v3_1);
        }
        return;
    }

Method com.microsoft.appcenter.utils.storage.DatabaseManager.put() calling method android.database.sqlite.SQLiteDatabase.insertOrThrow()


    public long put(android.content.ContentValues p9)
    {
        long v2;
        if (this.mIMDB != null) {
            p9.put("oid", Long.valueOf(this.mIMDBAutoInc));
            this.mIMDB.put(Long.valueOf(this.mIMDBAutoInc), p9);
            v2 = this.mIMDBAutoInc;
            this.mIMDBAutoInc = (1 + v2);
        } else {
            try {
                v2 = this.getDatabase().insertOrThrow(this.mTable, 0, p9);
            } catch (RuntimeException v1) {
                this.switchToInMemory("put", v1);
            }
            if ((((long) this.mMaxNumberOfRecords) < this.getRowCount()) && (this.mMaxNumberOfRecords > 0)) {
                android.database.Cursor v0 = this.getCursor(0, 0, 1);
                v0.moveToNext();
                this.delete(v0.getLong(0));
                v0.close();
            }
        }
        return v2;
    }

Method com.microsoft.appcenter.utils.storage.DatabaseManager.delete() calling method android.database.sqlite.SQLiteDatabase.execSQL()


    public void delete(java.util.List p8)
    {
        if (p8.size() > 0) {
            if (this.mIMDB != null) {
                String v2_4 = p8.iterator();
                while (v2_4.hasNext()) {
                    this.mIMDB.remove(((Long) v2_4.next()));
                }
            } else {
                try {
                    String v2_1 = this.getDatabase();
                    java.util.Map v3_8 = new StringBuilder().append("DELETE FROM ").append(this.mTable).append(" WHERE ").append("oid").append(" IN (%s);").toString();
                    Object[] v4_6 = new Object[1];
                    v4_6[0] = android.text.TextUtils.join(", ", p8);
                    v2_1.execSQL(String.format(v3_8, v4_6));
                } catch (RuntimeException v0) {
                    this.switchToInMemory("delete", v0);
                }
            }
        }
        return;
    }

Method com.microsoft.appcenter.utils.storage.DatabaseManager$1.onUpgrade() calling method android.database.sqlite.SQLiteDatabase.execSQL()


    public void onUpgrade(android.database.sqlite.SQLiteDatabase p3, int p4, int p5)
    {
        if (!com.microsoft.appcenter.utils.storage.DatabaseManager.access$200(this.this$0).onUpgrade(p3, p4, p5)) {
            p3.execSQL(new StringBuilder().append("DROP TABLE `").append(com.microsoft.appcenter.utils.storage.DatabaseManager.access$000(this.this$0)).append("`").toString());
            this.onCreate(p3);
        }
        return;
    }

Method com.microsoft.appcenter.utils.storage.DatabaseManager$1.onCreate() calling method android.database.sqlite.SQLiteDatabase.execSQL()


    public void onCreate(android.database.sqlite.SQLiteDatabase p7)
    {
        StringBuilder v1_1 = new StringBuilder("CREATE TABLE `");
        v1_1.append(com.microsoft.appcenter.utils.storage.DatabaseManager.access$000(this.this$0));
        v1_1.append("` (oid INTEGER PRIMARY KEY AUTOINCREMENT");
        java.util.Iterator v4 = com.microsoft.appcenter.utils.storage.DatabaseManager.access$100(this.this$0).valueSet().iterator();
        while (v4.hasNext()) {
            java.util.Map$Entry v0_1 = ((java.util.Map$Entry) v4.next());
            v1_1.append(", `").append(((String) v0_1.getKey())).append("` ");
            Object v2 = v0_1.getValue();
            if ((!(v2 instanceof Double)) && (!(v2 instanceof Float))) {
                if ((!(v2 instanceof Number)) && (!(v2 instanceof Boolean))) {
                    if (!(v2 instanceof byte[])) {
                        v1_1.append("TEXT");
                    } else {
                        v1_1.append("BLOB");
                    }
                } else {
                    v1_1.append("INTEGER");
                }
            } else {
                v1_1.append("REAL");
            }
        }
        v1_1.append(");");
        p7.execSQL(v1_1.toString());
        return;
    }

Method com.microsoft.appcenter.persistence.DatabasePersistence$1.onUpgrade() calling method android.database.sqlite.SQLiteDatabase.execSQL()


    public boolean onUpgrade(android.database.sqlite.SQLiteDatabase p2, int p3, int p4)
    {
        p2.execSQL("ALTER TABLE logs ADD COLUMN `target_token` TEXT");
        p2.execSQL("ALTER TABLE logs ADD COLUMN `type` TEXT");
        return 1;
    }

Method com.adobe.mobile.AnalyticsTrackTimedAction.initializeDatabase() calling method android.database.sqlite.SQLiteDatabase.execSQL()


    protected void initializeDatabase()
    {
        try {
            this.database.execSQL("CREATE TABLE IF NOT EXISTS TIMEDACTIONS (ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT, STARTTIME INTEGER, ADJSTARTTIME INTEGER)");
            this.database.execSQL("CREATE TABLE IF NOT EXISTS CONTEXTDATA (ID INTEGER PRIMARY KEY AUTOINCREMENT, ACTIONID INTEGER, KEY TEXT, VALUE TEXT, FOREIGN KEY(ACTIONID) REFERENCES TIMEDACTIONS(ID))");
        } catch (Exception v0_0) {
            Object[] v2_1 = new Object[2];
            v2_1[0] = this.logPrefix;
            v2_1[1] = v0_0.getMessage();
            com.adobe.mobile.StaticMethods.logErrorFormat("%s - Unable to open or create timed actions database (%s)", v2_1);
        } catch (Exception v0_1) {
            Object[] v2_0 = new Object[2];
            v2_0[0] = this.logPrefix;
            v2_0[1] = v0_1.getMessage();
            com.adobe.mobile.StaticMethods.logErrorFormat("%s - Uknown error creating timed actions database (%s)", v2_0);
        }
        return;
    }

Method com.adobe.mobile.AbstractHitDatabase.initializeDatabase() calling method android.database.sqlite.SQLiteDatabase.execSQL()


    protected void initializeDatabase()
    {
        try {
            this.database.execSQL(this.dbCreateStatement);
        } catch (Exception v0_1) {
            Object[] v2_1 = new Object[2];
            v2_1[0] = this.logPrefix;
            v2_1[1] = v0_1.getLocalizedMessage();
            com.adobe.mobile.StaticMethods.logErrorFormat("%s - Unable to create database due to an invalid path (%s)", v2_1);
        } catch (Exception v0_0) {
            Object[] v2_0 = new Object[2];
            v2_0[0] = this.logPrefix;
            v2_0[1] = v0_0.getLocalizedMessage();
            com.adobe.mobile.StaticMethods.logErrorFormat("%s - Unable to create database due to a sql error (%s)", v2_0);
        } catch (Exception v0_2) {
            Object[] v2_3 = new Object[2];
            v2_3[0] = this.logPrefix;
            v2_3[1] = v0_2.getLocalizedMessage();
            com.adobe.mobile.StaticMethods.logErrorFormat("%s - Unable to create database due to an unexpected error (%s)", v2_3);
        }
        return;
    }

Method com.microsoft.appcenter.utils.storage.DatabaseManager.delete() calling method android.database.sqlite.SQLiteDatabase.delete()


    public void delete(String p11, Object p12)
    {
        if (this.mIMDB != null) {
            if (!"oid".equals(p11)) {
                java.util.Iterator v2 = this.mIMDB.entrySet().iterator();
                while (v2.hasNext()) {
                    Object v3 = ((android.content.ContentValues) ((java.util.Map$Entry) v2.next()).getValue()).get(p11);
                    if ((v3 != null) && (v3.equals(p12))) {
                        v2.remove();
                    }
                }
            } else {
                if ((p12 != null) && ((p12 instanceof Number))) {
                    this.mIMDB.remove(Long.valueOf(((Number) p12).longValue()));
                } else {
                    throw new IllegalArgumentException("Primary key should be a number type and cannot be null");
                }
            }
        } else {
            try {
                boolean v4_11 = this.getDatabase();
                Long v5_2 = this.mTable;
                long v6_5 = new StringBuilder().append(p11).append(" = ?").toString();
                String[] v7_2 = new String[1];
                v7_2[0] = String.valueOf(p12);
                v4_11.delete(v5_2, v6_5, v7_2);
            } catch (RuntimeException v0) {
                this.switchToInMemory("delete", v0);
            }
        }
        return;
    }

Method com.microsoft.appcenter.utils.storage.DatabaseManager.clear() calling method android.database.sqlite.SQLiteDatabase.delete()


    public void clear()
    {
        if (this.mIMDB != null) {
            this.mIMDB.clear();
        } else {
            try {
                this.getDatabase().delete(this.mTable, 0, 0);
            } catch (RuntimeException v0) {
                this.switchToInMemory("clear", v0);
            }
        }
        return;
    }

Method com.adobe.mobile.AbstractHitDatabase.deleteHit() calling method android.database.sqlite.SQLiteDatabase.delete()


    protected void deleteHit(String p9)
    {
        if ((p9 != null) && (p9.trim().length() != 0)) {
            try {
                String v1_9 = this.database;
                String v5_1 = new String[1];
                v5_1[0] = p9;
                v1_9.delete("HITS", "ID = ?", v5_1);
                this.numberOfUnsentHits = (this.numberOfUnsentHits - 1);
            } catch (String v1_10) {
                throw v1_10;
            } catch (Exception v0_2) {
                Object[] v3_18 = new Object[2];
                v3_18[0] = this.logPrefix;
                v3_18[1] = v0_2.getLocalizedMessage();
                com.adobe.mobile.StaticMethods.logErrorFormat("%s - Unable to delete hit due to an unopened database (%s)", v3_18);
            }
        } else {
            Object v2_1 = new Object[1];
            v2_1[0] = this.logPrefix;
            com.adobe.mobile.StaticMethods.logDebugFormat("%s - Unable to delete hit due to an invalid parameter", v2_1);
        }
        return;
    }

Method com.adobe.mobile.AbstractHitDatabase.clearTrackingQueue() calling method android.database.sqlite.SQLiteDatabase.delete()


    protected void clearTrackingQueue()
    {
        try {
            this.database.delete("HITS", 0, 0);
            this.numberOfUnsentHits = 0;
        } catch (String v1_3) {
            throw v1_3;
        } catch (Exception v0_0) {
            Object[] v3_4 = new Object[2];
            v3_4[0] = this.logPrefix;
            v3_4[1] = v0_0.getLocalizedMessage();
            com.adobe.mobile.StaticMethods.logErrorFormat("%s - Unable to clear tracking queue due to a sql error (%s)", v3_4);
        } catch (Exception v0_2) {
            Object[] v3_1 = new Object[2];
            v3_1[0] = this.logPrefix;
            v3_1[1] = v0_2.getLocalizedMessage();
            com.adobe.mobile.StaticMethods.logErrorFormat("%s - Unable to clear tracking queue due to an unexpected error (%s)", v3_1);
        }
        return;
    }

Method com.adobe.mobile.ThirdPartyQueue.prepareStatements() calling method android.database.sqlite.SQLiteDatabase.compileStatement()


    protected void prepareStatements()
    {
        try {
            this._preparedInsertStatement = this.database.compileStatement("INSERT INTO HITS (URL, POSTBODY, POSTTYPE, TIMESTAMP, TIMEOUT) VALUES (?, ?, ?, ?, ?)");
        } catch (Exception v0_1) {
            Object[] v2_2 = new Object[2];
            v2_2[0] = this.logPrefix;
            v2_2[1] = v0_1.getLocalizedMessage();
            com.adobe.mobile.StaticMethods.logErrorFormat("%s - Unable to create database due to an invalid path (%s)", v2_2);
        } catch (Exception v0_0) {
            Object[] v2_1 = new Object[2];
            v2_1[0] = this.logPrefix;
            v2_1[1] = v0_0.getLocalizedMessage();
            com.adobe.mobile.StaticMethods.logErrorFormat("%s - Unable to create database due to a sql error (%s)", v2_1);
        } catch (Exception v0_2) {
            Object[] v2_0 = new Object[2];
            v2_0[0] = this.logPrefix;
            v2_0[1] = v0_2.getLocalizedMessage();
            com.adobe.mobile.StaticMethods.logErrorFormat("%s - Unable to create database due to an unexpected error (%s)", v2_0);
        }
        return;
    }

Method com.adobe.mobile.AnalyticsWorker.prepareStatements() calling method android.database.sqlite.SQLiteDatabase.compileStatement()


    protected void prepareStatements()
    {
        try {
            this._preparedInsertStatement = this.database.compileStatement("INSERT INTO HITS (URL, TIMESTAMP) VALUES (?, ?)");
        } catch (Exception v0_1) {
            Object[] v2_1 = new Object[1];
            v2_1[0] = v0_1.getLocalizedMessage();
            com.adobe.mobile.StaticMethods.logErrorFormat("Analytics - Unable to create database due to an invalid path (%s)", v2_1);
        } catch (Exception v0_0) {
            Object[] v2_0 = new Object[1];
            v2_0[0] = v0_0.getLocalizedMessage();
            com.adobe.mobile.StaticMethods.logErrorFormat("Analytics - Unable to create database due to a sql error (%s)", v2_0);
        } catch (Exception v0_2) {
            Object[] v2_3 = new Object[1];
            v2_3[0] = v0_2.getLocalizedMessage();
            com.adobe.mobile.StaticMethods.logErrorFormat("Analytics - Unable to create database due to an unexpected error (%s)", v2_3);
        }
        return;
    }

Method com.adobe.mobile.AnalyticsTrackTimedAction.prepareStatements() calling method android.database.sqlite.SQLiteDatabase.compileStatement()


    protected void prepareStatements()
    {
        this.sqlSelectAction = "SELECT ID, STARTTIME, ADJSTARTTIME FROM TIMEDACTIONS WHERE NAME=?";
        this.sqlExistsAction = "SELECT COUNT(*) FROM TIMEDACTIONS WHERE NAME=?";
        this.sqlSelectContextDataForAction = "SELECT KEY, VALUE FROM CONTEXTDATA WHERE ACTIONID=?";
        this.sqlExistsContextDataByActionAndKey = "SELECT COUNT(*) FROM CONTEXTDATA WHERE ACTIONID=? AND KEY=?";
        try {
            this.sqlInsertAction = this.database.compileStatement("INSERT INTO TIMEDACTIONS (NAME, STARTTIME, ADJSTARTTIME) VALUES (@NAME, @START, @START)");
            this.sqlUpdateAction = this.database.compileStatement("UPDATE TIMEDACTIONS SET ADJSTARTTIME=ADJSTARTTIME+@DELTA WHERE ADJSTARTTIME!=0");
            this.sqlUpdateActionsClearAdjustedTime = this.database.compileStatement("UPDATE TIMEDACTIONS SET ADJSTARTTIME=0");
            this.sqlDeleteAction = this.database.compileStatement("DELETE FROM TIMEDACTIONS WHERE ID=@ID");
            this.sqlInsertContextData = this.database.compileStatement("INSERT INTO CONTEXTDATA(ACTIONID, KEY, VALUE) VALUES (@ACTIONID, @KEY, @VALUE)");
            this.sqlUpdateContextData = this.database.compileStatement("UPDATE CONTEXTDATA SET VALUE=@VALUE WHERE ACTIONID=@ACTIONID AND KEY=@KEY");
            this.sqlDeleteContextDataForAction = this.database.compileStatement("DELETE FROM CONTEXTDATA WHERE ACTIONID=@ACTIONID");
        } catch (Exception v0_1) {
            Object[] v2_8 = new Object[1];
            v2_8[0] = v0_1.getMessage();
            com.adobe.mobile.StaticMethods.logErrorFormat("Analytics - unable to prepare the needed SQL statements for interacting with the timed actions database (%s)", v2_8);
        } catch (Exception v0_0) {
            Object[] v2_7 = new Object[1];
            v2_7[0] = v0_0.getMessage();
            com.adobe.mobile.StaticMethods.logErrorFormat("Analytics - Unknown error preparing sql statements (%s)", v2_7);
        }
        return;
    }

Method com.adobe.mobile.ThirdPartyQueue.selectOldestHit() calling method android.database.sqlite.SQLiteDatabase.query()


    protected com.adobe.mobile.AbstractHitDatabase$Hit selectOldestHit()
    {
        com.adobe.mobile.AbstractHitDatabase$Hit v11 = 0;
        android.database.Cursor v9 = 0;
        try {
            v9 = this.database.query("HITS", com.adobe.mobile.ThirdPartyQueue._hitsSelectedColumns, 0, 0, 0, 0, "ID ASC", "1");
        } catch (Exception v10_1) {
            Object[] v1_4 = new Object[2];
            v1_4[0] = this.logPrefix;
            v1_4[1] = v10_1.getMessage();
            com.adobe.mobile.StaticMethods.logErrorFormat("%s - Unable to read from database (%s)", v1_4);
            if (v9 == null) {
                return v11;
            } else {
                v9.close();
                return v11;
            }
            if (v9 == null) {
                return v11;
            } else {
                v9.close();
                return v11;
            }
        } catch (Exception v10_0) {
            Object[] v1_2 = new Object[2];
            v1_2[0] = this.logPrefix;
            v1_2[1] = v10_0.getMessage();
            com.adobe.mobile.StaticMethods.logErrorFormat("%s - Unknown error reading from database (%s)", v1_2);
            if (v9 == null) {
                return v11;
            } else {
                v9.close();
                return v11;
            }
        } catch (Throwable v0_17) {
            throw v0_17;
        }
        if (v9.moveToFirst()) {
            com.adobe.mobile.AbstractHitDatabase$Hit v12_1 = new com.adobe.mobile.AbstractHitDatabase$Hit();
            try {
                v12_1.identifier = v9.getString(0);
                v12_1.urlFragment = v9.getString(1);
                v12_1.postBody = v9.getString(2);
                v12_1.postType = v9.getString(3);
                v12_1.timestamp = v9.getLong(4);
                v12_1.timeout = v9.getInt(5);
                v11 = v12_1;
            } catch (Throwable v0_16) {
                if (v9 != null) {
                    v9.close();
                }
                throw v0_16;
            } catch (Exception v10_1) {
                v11 = v12_1;
            } catch (Exception v10_0) {
                v11 = v12_1;
            }
        }
    }

Method com.adobe.mobile.AnalyticsWorker.selectOldestHit() calling method android.database.sqlite.SQLiteDatabase.query()


    protected com.adobe.mobile.AbstractHitDatabase$Hit selectOldestHit()
    {
        com.adobe.mobile.AbstractHitDatabase$Hit v11 = 0;
        android.database.Cursor v9 = 0;
        try {
            Throwable v0_1 = this.database;
            int v2_2 = new String[3];
            v2_2[0] = "ID";
            v2_2[1] = "URL";
            v2_2[2] = "TIMESTAMP";
            v9 = v0_1.query("HITS", v2_2, 0, 0, 0, 0, "ID ASC", "1");
        } catch (Exception v10_1) {
            Object[] v1_4 = new Object[1];
            v1_4[0] = v10_1.getMessage();
            com.adobe.mobile.StaticMethods.logErrorFormat("Analytics - Unable to read from database (%s)", v1_4);
            if (v9 == null) {
                return v11;
            } else {
                v9.close();
                return v11;
            }
            if (v9 == null) {
                return v11;
            } else {
                v9.close();
                return v11;
            }
        } catch (Exception v10_0) {
            Object[] v1_2 = new Object[1];
            v1_2[0] = v10_0.getMessage();
            com.adobe.mobile.StaticMethods.logErrorFormat("Analytics - Unknown error reading from database (%s)", v1_2);
            if (v9 == null) {
                return v11;
            } else {
                v9.close();
                return v11;
            }
        } catch (Throwable v0_11) {
            throw v0_11;
        }
        if (v9.moveToFirst()) {
            com.adobe.mobile.AbstractHitDatabase$Hit v12_1 = new com.adobe.mobile.AbstractHitDatabase$Hit();
            try {
                v12_1.identifier = v9.getString(0);
                v12_1.urlFragment = v9.getString(1);
                v12_1.timestamp = v9.getLong(2);
                v11 = v12_1;
            } catch (Throwable v0_10) {
                if (v9 != null) {
                    v9.close();
                }
                throw v0_10;
            } catch (Exception v10_1) {
                v11 = v12_1;
            } catch (Exception v10_0) {
                v11 = v12_1;
            }
        }
    }