|
[WINDEV MOBILE 19] Desativar integridade no SQLITE |
Iniciado por pedrosao, fev., 21 2015 2:49 AM - Sem resposta |
| |
| | | |
|
| |
Membro registado 42 mensagems |
|
Publicado em fevereiro, 21 2015 - 2:49 AM |
import android.database.sqlite.*; import android.content.Context; import android.util.*; import android.database.*; PUBLIC static string AtivarDesativarIntegridadeSQLite(string sTipo){ string DB_NAME = "O NOME DO SEU ARQUIVO.db"; string alterQuery = ""; SQLiteDatabase db; try { db = getContexteApplication().openOrCreateDatabase(DB_NAME, 0, null); try { IF (sTipo.toLowerCase() == "desativar"){ db.execSQL("PRAGMA synchronous = OFF;"); db.rawQuery("PRAGMA journal_mode = OFF;",null); } ELSE{ db.execSQL("PRAGMA synchronous = FULL;"); db.rawQuery("PRAGMA journal_mode = DELETE;",null); } db.close(); RETURN "ok"; } catch(SQLException e) { db.close(); RETURN e.getMessage(); } } catch (SQLException e) { RETURN e.getMessage(); } }
IF InAndroidSimulatorMode() = False THEN sErro is string = AtivarDesativarIntegridadeSQLite("desativar") IF sErro <> "ok" THEN Error(sErro) EndProgram() END ELSE HExecuteSQLQuery(Query,Minhaconexao,hQueryWithoutCorrection,"PRAGMA synchronous = OFF;") HExecuteSQLQuery(Query,Minhaconexao,hQueryWithoutCorrection,"PRAGMA journal_mode = OFF;") END |
| |
| |
| | | |
|
| | | | |
| | |
|