Skip to content

Commit

Permalink
优化代码,修改bug。
Browse files Browse the repository at this point in the history
  • Loading branch information
873764182 committed Oct 21, 2017
1 parent 3838d09 commit 598ce88
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions app/temp_code.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@


SQLiteDatabase db = mHelper.getWritableDatabase();
try
{
// ByteArrayOutputStream bos = new ByteArrayOutputStream();
// ObjectOutputStream oos = new ObjectOutputStream(bos);
// oos.write(command);
// byte[] buff = bos.toByteArray();
// ByteArrayInputStream bis = new
// ByteArrayInputStream(buff);
String sql = "INSERT INTO " + DBHelper.TABLE_NAME
+ " VALUES(?,?);";
SQLiteStatement ss = db.compileStatement(sql);
ss.bindBlob(1, command);
ss.bindString(2, "N");
ss.execute();
}
finally
{
db.close();
}


public void insertSeedItem(long ToyID, byte[]ToySeed) {
String sqlstr = "insert into " + TABLE_SEED + " (ToyID, ToySeed,ToyMemo) values (?,?,?);";
Object[] args = new Object[]{ToyID,ToySeed,null};
try{
mTestDatabase.execSQL(sqlstr,args);
} catch (SQLException ex) {
}
Log.i("testSeedDB", "insertSeedItem");

}

public byte[] GetSeedItem(long ToyID) {
Cursor cur;
byte[] strSeed = null;

String col[] = {"ToyID", "ToySeed" ,"ToyMemo"};
String strToy = "ToyID=" + new Integer((int) ToyID).toString();
try{
cur = mTestDatabase.query(TABLE_SEED, col, strToy, null, null, null, null);
cur.moveToFirst();
strSeed = cur.getBlob(1);
} catch (SQLException ex) {
}
if (cur !=null) cur.close;
Log.i("testSeedDB", strToy);
return strSeed;
}

0 comments on commit 598ce88

Please sign in to comment.