I'have this code
public class DatabaseHelper extends SQLiteOpenHelper {
public static final String DATABASE_NAME = "prova";
protected Context context;
public DatabaseHelper(Context context) {
super(context, DATABASE_NAME, null, 1);
this.context = context;
}
@Override
public void onCreate(SQLiteDatabase db) {
String s;
try {
Toast.makeText(context, "1", 2000).show();
InputStream in =
context.getResources().openRawResource(R.raw.mysql);
DocumentBuilder builder =
DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document doc = builder.parse(in, null);
NodeList statements = doc.getElementsByTagName("st");
for (int i=0; i<st.getLength(); i++) {
s =
st.item(i).getChildNodes().item(0).getNodeValue();
db.execSQL(s);
}
} catch (Throwable t) {
Toast.makeText(context, t.toString(), 50000).show();
}
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int
newVersion) {
db.execSQL("DROP TABLE IF EXISTS employees");
onCreate(db);
}
}
This class read myxml file and executes sql instruction that are in
the statements .
Because the XML file is about 4MB I'have to split it in three or four
files, but I don't know how to modify the code to do this. Thanks for
any suggestion.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en