-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAchatLocationDatabaseHelper.java
More file actions
63 lines (44 loc) · 1.8 KB
/
AchatLocationDatabaseHelper.java
File metadata and controls
63 lines (44 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package com.example.khafi.myapplications;
import android.content.ContentValues;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
/**
* Created by sofian on 12/04/2018.
*/
public class AchatLocationDatabaseHelper extends SQLiteOpenHelper {
private static final String DB_NAME = "achat_location";
private static final int DB_VERSION = 1;
AchatLocationDatabaseHelper(Context context)
{
super(context,DB_NAME,null,DB_VERSION);
}
public void onCreate(SQLiteDatabase db)
{
db.execSQL("CREATE TABLE LOCATION ("
+ "LOYER INTEGER,"
+ "ADRESSE TEXT,"
+ "APERCU BLOB);");
db.execSQL("CREATE TABLE ACHAT (_id_achat INTEGER PRIMARY KEY AUTOINCREMENT,"
+ "PRIX INTEGER,"
+ "ADRESSE TEXT,"
+ "APERCU BLOB);");
insertLocation(db, 2005, "4 jjj fff Road",R.drawable.image1);
insertLocation(db, 5869, "Road",R.drawable.image2);
insertLocation(db, 7200, "4 Rfghhg oad",R.drawable.image3);
insertLocation(db, 2400, "Road",R.drawable.image4);
insertLocation(db, 600, "Roajj fx d",R.drawable.imagep);
}
public void onUpgrade(SQLiteDatabase db,int oldVersion,int newVersion) {}
public static void insertLocation(SQLiteDatabase db,double loyer, String adresse,int id_image)
{
ContentValues locationValues = new ContentValues();
locationValues.put("LOYER",loyer);
locationValues.put("ADRESSE",adresse);
locationValues.put("APERCU",id_image);
db.insert("LOCATION",null,locationValues);
}
public static void insertOffreAchat(SQLiteDatabase db)
{
}
}