PROFESSIONAL NEWSGROUPS
WINDEV
,
WEBDEV
and
WINDEV Mobile
Home
|
Recent messages
|
Connect
|
Sign out
|
English
Home
→
WINDEV 25
→
[WINDEV MOBILE 19] Desativar integridade no SQLITE
[WINDEV MOBILE 19] Desativar integridade no SQLITE
Started by pedrosao, Feb., 21 2015 2:49 AM - No answer
Connect yourself…
pedrosao
#1
Registered member
42 messages
Popularité : +7 (7 votes)
Posted on February, 21 2015 - 2:49 AM
import android.database.sqlite
.
*
;
import android.content.Context
;
import android.util
.
*
;
import android.database
.
*
;
PUBLIC static string
AtivarDesativarIntegridadeSQLite
(
string
s
Tipo
)
{
string
DB_NAME
=
"O NOME DO SEU ARQUIVO.db"
;
string
alterQuery
=
""
;
SQLiteDatabase db
;
try
{
db
=
getContexteApplication
(
)
.
openOrCreateDatabase
(
DB_NAME
,
0
,
null
)
;
try
{
IF
(
s
Tipo.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
(
)
;
}
}
// USANDO NA SUA APLICAÇÃO
IF
InAndroidSimulatorMode
(
) =
False
THEN
s
Erro is
string
=
AtivarDesativarIntegridadeSQLite
(
"desativar"
)
IF
s
Erro
<
>
"ok"
THEN
Error
(
s
Erro
)
EndProgram
(
)
END
ELSE
HExecuteSQLQuery
(
Query
,
Minhaconexao
,
hQueryWithoutCorrection
,
"PRAGMA synchronous = OFF;"
)
HExecuteSQLQuery
(
Query
,
Minhaconexao
,
hQueryWithoutCorrection
,
"PRAGMA journal_mode = OFF;"
)
END
Report
0
0
→ Go back to WINDEV 25
WINDEV 25
Français
English
Español
Portuguesa
Close this window
Search type
Only topics
All the messages
Search period
Any time
Past hour
Past 24 hours
Past week
Past month
Past year
Cancel
Preview of your message
Adding an image
Import an image from a URL
Send an image from a file of your disk
Drop a file or click "Browse..."
or
Cancel
0%
WLanguage
SQL
XML, HTML
JAVA, Javascript
Text