Où puis-je trouver un exemple de fichier de firebase database SQLite ou dump de celui-ci?

J’ai vraiment besoin d’un fichier de firebase database sqlite pour les études. Je crée une application en C # et j’ai besoin d’une firebase database avec de nombreuses tables, champs, vues, index, contraintes, etc. Et je ne veux pas le créer moi-même en utilisant l’outil de ligne de commande sqlite.

Donc, je suppose que quelqu’un peut dire où je peux trouver un tel fichier, peut être différentes applications ou exemples, ou même peut m’envoyer leur propre fichier de firebase database. J’apprécierai toute aide.

Il existe une belle firebase database appelée Chinook. Il essaie d’être l’exemple moderne pour remplacer NorthWind. Ils ont des versions pour différents serveurs de bases de données, y compris SQLite.

Vérifiez également cet exemple dans les forums de clients SQLite .NET (attachés au premier message)

  • Obtenir que le projet Microsoft EFQuerySamples fonctionne avec SQLite

Peut-être qu’un outil graphique pour créer des bases de données facilitera le démarrage, cochez celui-ci, gratuit pour un usage personnel

Personnellement, je crée des bases de données SQLite pour tester les mappages NHibernate. Généralement, je crée mes classes et mes mappages, puis utilise les mappages pour générer un schéma vers un nouveau fichier SQLite (ou plus souvent dans la firebase database de la mémoire) et l’utiliser. La plupart des articles d’introduction NHibernate le font également.

Essayez de rechercher des tutoriels sqlite – ils ont souvent des exemples que vous pouvez télécharger (par exemple, http://souptonuts.sourceforge.net/readme_sqlite_tutorial.html )

J’ai utilisé l’opération sqlightCrud

Première classe de firebase database de création. paquet com.db;

import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.SQLException; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.util.Log; import android.widget.Toast; public class DataBaseSampleActivity { /** for database */ static final Ssortingng DataBaseName = "EmployeDB"; /** for employee table */ static final Ssortingng EmployeTable = "Employees"; static final Ssortingng ColEmpID = "EmpId"; static final Ssortingng ColEmpName = "EmpName"; static final Ssortingng ColEmpAge = "EmpAge"; static final Ssortingng ColDept = "Dept"; /** for department table */ static final Ssortingng DeptTable = "Department"; static final Ssortingng ColDeptID = "DeptId"; static final Ssortingng ColDeptName = "DeptName"; public static final int DATABASE_VERSION = 2; //private static final Ssortingng KEY_ROWID = "_id"; private static final Ssortingng EMPLOYEE_TABLE_CREATE ="Create table " + EmployeTable + //"(_id INTEGER UNIQUE," + [old code] "("+ColEmpID + " INTEGER PRIMARY KEY AUTOINCREMENT," + ColEmpName + " VARCHAR(15) ," + ColEmpAge + " INT(15) ," + ColDept + " VARCHAR(15)) "; private final Context context; private DatabaseHelper DBHelper; private SQLiteDatabase db; public DataBaseSampleActivity(Context ctx){ Log.i("test****", "**test***"); this.context = ctx; DBHelper = new DatabaseHelper(context); } private static class DatabaseHelper extends SQLiteOpenHelper{ public DatabaseHelper(Context context){ super(context, DataBaseName , null, DATABASE_VERSION); Log.i("context","context"); } @Override public void onCreate(SQLiteDatabase db) { // TODO Auto-generated method stub db.execSQL(EMPLOYEE_TABLE_CREATE); Log.i("************", "table created"); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { // TODO Auto-generated method stub Log.w("tag", "Upgrading database from version " + oldVersion + " to "+ newVersion + ", which will destroy all old data"); db.execSQL("DROP TABLE IF EXISTS " + EmployeTable); onCreate(db); } }; public DataBaseSampleActivity open() throws SQLException{ db = DBHelper.getWritableDatabase(); Log.i("open", "message"); return this; } public void close(){ DBHelper.close(); } //public long insert(Integer empid, Ssortingng empname, Integer empage, Ssortingng empdept) { public long insert(Ssortingng empname, Integer empage, Ssortingng empdept) { Log.i("**** suruchitest **** ","*** test ***"); ContentValues initialValues = new ContentValues(); //initialValues.put(ColEmpID, empid); initialValues.put(ColEmpName, empname); initialValues.put(ColEmpAge, empage); initialValues.put(ColDept, empdept); return db.insert(EmployeTable, null, initialValues); } public Cursor getEmpValues(){ Cursor mCursor = db.query(EmployeTable, null, null, null, null, null, null); return mCursor; } public boolean deleteEmpList(long rowId){ Toast.makeText(context, "deleted", 2000).show(); return db.delete(EmployeTable, ColEmpID +" = " + rowId, null) > 0; } public boolean updateEmplist(Ssortingng empname, Integer empage, Ssortingng empdept, Integer rowid){ ContentValues initialValues = new ContentValues(); Log.i("##### "+rowid,""+empname+" "+empage+" "+empdept); //initialValues.put(ColEmpID, rowid); initialValues.put(ColEmpName,empname); initialValues.put(ColEmpAge,empage); initialValues.put(ColDept,empdept); try{ int b = db.update(EmployeTable, initialValues, ColEmpID+ " = " + rowid, null); Log.i("update", "up "+rowid+" ddd "+b); return true; }catch (Exception e){ Log.d("asdfasdfsadfasdf", "_--___--__--_=-_"); return false; } } } 2. create Main Activity package com.db; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class MainActivity extends Activity implements OnClickListener { Button buttonsubmit; EditText empid,empname,empage,empdept; Ssortingng emp_name, emp_dept; //Integer emp_id,emp_age; Integer emp_age; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); buttonsubmit = (Button) findViewById(R.id.btnSubmit); buttonsubmit.setOnClickListener(this); // empid =(EditText) findViewById(R.id.empid); empname =(EditText) findViewById(R.id.empname); empage =(EditText) findViewById(R.id.empage); empdept =(EditText) findViewById(R.id.empdpt); } @Override public void onClick(View v) { // TODO Auto-generated method stub DataBaseSampleActivity dbObj = new DataBaseSampleActivity(getApplicationContext()); // Ssortingng Emp_ids = empid.getText().toSsortingng(); // emp_id = Integer.parseInt(Emp_ids); //emp_id = empid.getText().toSsortingng(); Ssortingng Emp_ages = empage.getText().toSsortingng(); emp_age = Integer.parseInt(Emp_ages); //emp_age = empage.getText().toSsortingng(); emp_name = empname.getText().toSsortingng(); emp_dept = empdept.getText().toSsortingng(); try { Log.i("try", "message"); dbObj.open(); //long temp = dbObj.insert(emp_id, emp_name, emp_age, emp_dept); long temp = dbObj.insert(emp_name, emp_age, emp_dept); //Toast.makeText(getApplicationContext(), "temp"+temp, 3000).show(); dbObj.close(); Intent intent = new Intent(this,ShowListView.class); startActivity(intent); } catch (Exception e) { // TODO: handle exception Log.i("catch", "message"); } } } 2. Create listclass to show tha data package com.db; import java.lang.reflect.Array; import java.util.ArrayList; import android.R.integer; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.database.Cursor; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.Button; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.ImageView; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; public class ShowListView extends Activity { ArrayList arrname = new ArrayList(); ArrayList arrage = new ArrayList(); ArrayList arrdept = new ArrayList(); ArrayList arrRowId = new ArrayList(); ArrayList arrDelId = new ArrayList(); Array[] arr; Button deleteBtn; Button btnadd; int index = 0; public int pos; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.emplist); //Toast.makeText(getApplicationContext(), "LIST VIEW", 5000).show(); ToGetCursorValues(); } public void ToGetCursorValues(){ DataBaseSampleActivity db = new DataBaseSampleActivity(getApplicationContext()); db.open(); try { Cursor cur = db.getEmpValues(); cur.moveToFirst(); arrRowId.clear(); arrname.clear(); arrage.clear(); arrdept.clear(); while (!cur.isAfterLast()) { arrRowId.add(cur.getInt(cur.getColumnIndex(db.ColEmpID))); arrname.add(cur.getSsortingng(cur.getColumnIndex(db.ColEmpName))); arrage.add(cur.getSsortingng(cur.getColumnIndex(db.ColEmpAge))); arrdept.add(cur.getSsortingng(cur.getColumnIndex(db.ColDept))); cur.moveToNext(); } //Log.i("#####","col "+arrlist.size()); //Toast.makeText(getApplicationContext(), "* "+arrname.size()+","+arrage.size()+","+arrdept.size(), 5000).show(); //Toast.makeText(getApplicationContext(), "***** "+arrRowId.get(0), 2000).show(); } catch (Exception e) { // TODO: handle exception } ListView lst = (ListView) findViewById(R.id.mylist); lst.setAdapter(new ListAdapter(getApplicationContext())); db.close(); } public class ListAdapter extends BaseAdapter implements OnCheckedChangeListener,OnClickListener{ private LayoutInflater inflater = null; public ListAdapter(Context c){ Log.i("Context","Context"); inflater = LayoutInflater.from(c); } @Override public int getCount() { // TODO Auto-generated method stub //return 0; return arrname.size(); } @Override public Object getItem(int position) { // TODO Auto-generated method stub return null; } @Override public long getItemId(int position) { // TODO Auto-generated method stub return 0; } class ViewHolder{ TextView empnameview; TextView empageview; TextView empdeptview; CheckBox empchkbox; } // create a new ImageView for each item referenced by the Adapter public View getView(final int position, View convertView, ViewGroup parent) { Log.i("*view","view*"); ViewHolder vh; //ImageView imageView; if (convertView == null) { // if it's not recycled, initialize some atsortingbutes Log.i("*null1*","*null1*"); vh = new ViewHolder(); convertView = inflater.inflate(R.layout.customlist, null); Log.i("*null2*","*null2*"); pos = position; vh.empnameview = (TextView) convertView.findViewById(R.id.ename); vh.empageview = (TextView) convertView.findViewById(R.id.eage); vh.empdeptview = (TextView) convertView.findViewById(R.id.edept); vh.empchkbox = (CheckBox) convertView.findViewById(R.id.ckekDelete); Log.i("*null3*","*null3*"); vh.empnameview.setText(arrname.get(position)); vh.empnameview.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent intent = new Intent(ShowListView.this,UpdateDB.class); Ssortingng name = arrname.get(position); int age = Integer.parseInt(arrage.get(position)); Ssortingng dept = arrdept.get(position); int rowid = arrRowId.get(position); intent.putExtra("KeyName" , name); intent.putExtra("Keyage" , age); intent.putExtra("Keydept" , dept); intent.putExtra("Rowid", rowid); startActivity(intent); } }); vh.empageview.setText(arrage.get(position)); vh.empdeptview.setText(arrdept.get(position)); vh.empchkbox.setOnCheckedChangeListener(new OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { // TODO Auto-generated method stub //Toast.makeText(getApplicationContext(), "OnChecked"+position, 2000).show(); if(buttonView.isChecked()){ arrDelId.add(arrRowId.get(position)); //Toast.makeText(getApplicationContext(), "OnChecked"+position, 2000).show(); // DataBaseSampleActivity db = new DataBaseSampleActivity(getApplicationContext()); // db.open(); // db.deleteEmpList(arrRowId.get(position)); // Toast.makeText(getApplicationContext(), "delet", 3000).show(); // db.close(); // } else{ for(int i=0;i