Saving Data on Android



Download 19,28 Mb.
Pdf ko'rish
bet81/292
Sana24.01.2022
Hajmi19,28 Mb.
#407089
1   ...   77   78   79   80   81   82   83   84   ...   292
Bog'liq
Bailey J., Dominguez A., Djermanovic D. - Saving Data on Android (1st Edition) - 2019

Construc/ng the query
The statement to perform a query on the user dictionary database looks like this:
cursor = contentResolver.query( 
    
// 1
 
    UserDictionary.Words.CONTENT_URI,    
    
// 2
 
    projection,                        
    
// 3
 
    selectionClause,                    
    
// 4
 
    selectionArgs,       
    
// 5
 
    sortOrder                           
)
The 
contentResolver
 object that is part of a 
context
 is utilized to call the query 
function and a list of arguments can be passed if necessary. The only required 
argument is the content URI. Below is an explanation of each of the parameters.
Saving Data on Android
Chapter 4: ContentProvider
raywenderlich.com
74


1. The content URI of the provider including the desired table.
2. The columns definitions to return for each row, this is a string array.
3. The selection clause, similar to a 
WHERE
 clause only excluding the where. A 
?
 is 
used in place of arguments.
4. The arguments to be utilized for the selection clause that fill in the 
?
.
5. The sort order such as 
"ASC"
 or ```"DESC"``.`
Note
: Allowing raw SQL statements from external sources can lead to 
malicious input from SQL injection attempts. Using the selection clause with 
?
 
representing a replaceable parameter and an array of selection arguments 
instead can prevent the user from making these attempts.
A content provider not only allows data to be read by an outside application, the data 
can also be updated, added to or deleted.

Download 19,28 Mb.

Do'stlaringiz bilan baham:
1   ...   77   78   79   80   81   82   83   84   ...   292




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish