package com.yahoo.squidb.data;

import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Build.VERSION;
import android.os.Build.VERSION_CODES;

import com.yahoo.squidb.data.SqlValidatorFactory.SqlValidator;

/*package*/ class SqlValidatorFactory {

    interface SqlValidator {

        void compileStatement(SQLiteDatabase db, String sql);
    }

    private static final SqlValidator INSTANCE;

    static {
        int version = VERSION.SDK_INT;
        if (version >= VERSION_CODES.JELLY_BEAN) {
            INSTANCE = new DefaultSqlValidator();
        } else if (version >= VERSION_CODES.ICE_CREAM_SANDWICH) {
            INSTANCE = new IcsSqlValidator();
        } else {
            // included for forks that reduce minSdk below 14
            INSTANCE = new DefaultSqlValidator();
        }
    }

    private SqlValidatorFactory() {
        //no instance
    }

    static SqlValidator getValidator() {
        return INSTANCE;
    }
}

/*package*/ class DefaultSqlValidator implements SqlValidator {

    @Override
    public void compileStatement(SQLiteDatabase db, String sql) {
        db.compileStatement(sql);
    }
}

/*package*/ class IcsSqlValidator implements SqlValidator {

    @Override
    public void compileStatement(SQLiteDatabase db, String sql) {
        Cursor c = db.rawQuery(sql, null);
        if (c != null) {
            c.close();
        }
    }
}

@@ -181,72 +181,8 @@
 S;%0A%0A
-import com.yahoo.squidb.data.SqlValidatorFactory.SqlValidator;%0A%0A
 /*pa
@@ -910,38 +910,43 @@
 ANCE;%0A    %7D%0A
-%7D%0A%0A/*package*/
+%0A    private static
  class Defau
@@ -983,32 +983,36 @@
 alidator %7B%0A%0A    
+ 
+   
 @Override%0A    pu
@@ -997,32 +997,36 @@
       @Override%0A
+    
     public void 
@@ -1083,16 +1083,20 @@
         
+    
 db.compi
@@ -1121,24 +1121,39 @@
     
-%7D%0A%7D%0A%0A/*package*/
+    %7D%0A    %7D%0A%0A    private static
  cla
@@ -1198,24 +1198,28 @@
 ator %7B%0A%0A    
+   
+ 
 @Override%0A  
@@ -1212,24 +1212,28 @@
   @Override%0A
+    
     public v
@@ -1294,16 +1294,20 @@
         
+ 
+   
 Cursor c
@@ -1329,24 +1329,28 @@
 sql, null);%0A
+    
         if (
@@ -1374,16 +1374,20 @@
         
+    
 c.close(
@@ -1385,24 +1385,38 @@
  c.close();%0A
+            %7D%0A
         %7D%0A  
@@ -1421,8 +1421,9 @@
     %7D%0A%7D%0A
+%0A

Make sql validators private static