From 598ce88031582d15b4592acbbf1950d84b42c6f3 Mon Sep 17 00:00:00 2001 From: panxiong <873764182@qq.com> Date: Sat, 21 Oct 2017 18:32:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E6=94=B9bug=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/temp_code.js | 51 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 app/temp_code.js diff --git a/app/temp_code.js b/app/temp_code.js new file mode 100644 index 0000000..c47d37f --- /dev/null +++ b/app/temp_code.js @@ -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; + } \ No newline at end of file