samiasoft
پنج شنبه 21 تیر 1397, 07:08 صبح
سلام دوستان
فرض کنید ما یک دیتابیس اسکیولایت اماده بصورت زیر ساختیم که 2 جدول دارد و میخواهیم این دیتابیس را داخل پوشه asset قرار بدیم و استفاده کنیم :
http://s9.picofile.com/file/8331558000/2018_07_12_063310.jpg
حال چگونه کلاس دیتابیس را برای جدول tble_file درست کنم؟ ایا اینطوری نوشتن درسته :
public class Table_file {
int id;
int id_students;
String file_name;
String file_comment;
public Table_file(int id, int id_students, String file_name, String file_comment) {
this.id = id;
this.id_students = id_students;
this.file_name = file_name;
this.file_comment = file_comment;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getId_students() {
return id_students;
}
public void setId_students(int id_students) {
this.id_students = id_students;
}
public String getFile_name() {
return file_name;
}
public void setFile_name(String file_name) {
this.file_name = file_name;
}
public String getFile_comment() {
return file_comment;
}
public void setFile_comment(String file_comment) {
this.file_comment = file_comment;
}
}
اما حالا کلید خارجی که وجود داره رو چطوری استفاده کنیم؟!!؟
ناگفته نماند برای ارتباط با دیتابیس اسکیولایت ازکتابخانه sqliteassethelper استفاده میکنم.
ممنون میشوم در مورد استفاده از این کتابخانه برای جداول رابطه ای راهنمایی کنید.
فرض کنید ما یک دیتابیس اسکیولایت اماده بصورت زیر ساختیم که 2 جدول دارد و میخواهیم این دیتابیس را داخل پوشه asset قرار بدیم و استفاده کنیم :
http://s9.picofile.com/file/8331558000/2018_07_12_063310.jpg
حال چگونه کلاس دیتابیس را برای جدول tble_file درست کنم؟ ایا اینطوری نوشتن درسته :
public class Table_file {
int id;
int id_students;
String file_name;
String file_comment;
public Table_file(int id, int id_students, String file_name, String file_comment) {
this.id = id;
this.id_students = id_students;
this.file_name = file_name;
this.file_comment = file_comment;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getId_students() {
return id_students;
}
public void setId_students(int id_students) {
this.id_students = id_students;
}
public String getFile_name() {
return file_name;
}
public void setFile_name(String file_name) {
this.file_name = file_name;
}
public String getFile_comment() {
return file_comment;
}
public void setFile_comment(String file_comment) {
this.file_comment = file_comment;
}
}
اما حالا کلید خارجی که وجود داره رو چطوری استفاده کنیم؟!!؟
ناگفته نماند برای ارتباط با دیتابیس اسکیولایت ازکتابخانه sqliteassethelper استفاده میکنم.
ممنون میشوم در مورد استفاده از این کتابخانه برای جداول رابطه ای راهنمایی کنید.