PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV Mobile 24 → AtivarDesativarIntegridadeSQLite() // Access Rapid
AtivarDesativarIntegridadeSQLite() // Access Rapid
Débuté par adrianoboller, 03 oct. 2014 16:16 - Aucune réponse
Membre enregistré
3 003 messages
Popularité : +89 (91 votes)
Posté le 03 octobre 2014 - 16:16
//Ativar Desativar Integridade SQLite

import android.database.sqlite.*;
import android.content.Context;
import android.util.*;
import android.database.*;
public static String AtivarDesativarIntegridadeSQLite(String sTipo){
String DB_NAME = "FaixaVermelha.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();
}
}

//Utilizando a função no seu aplicativo
//=====================================
//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