对于与查询相关的数据库问题,已达到已编译 SQL 语句缓存的最大大小?
朋友们,
我写了以下sqlite插入语句,这似乎是错误的。 在插入行之前,我检查记录是否存在,然后不要插入(ATM 数据超过 600 条记录)
已达到数据库编译 sql 语句缓存的最大大小。缓存中没有此 sql 语句的空间。从 atm where atmid 选择 1 =251 请更改您的sql语句以使用“?”对于bindargs,而不是
public void addAtm(ATM atm)
{
db.execSQL("INSERT INTO " + AtmsTable.NAME +
"(" +AtmsTable.COL_ID + ","
+AtmsTable.COL_BankID +","
+ AtmsTable.COL_BankNAME+","
+ AtmsTable.COL_BankPhone+","
+ AtmsTable.COL_BankAddress+","
+ AtmsTable.COL_BankCoordinates+","
+ AtmsTable.COL_BankCity+","
+ AtmsTable.COL_BankWebaddress+") Values ("
+atm.getAtmID()+","
+atm.getBankID()
+ ",'" + atm.getBankName().trim()
+"','" + atm.getPhone()
+"','" + atm.getAddress()
+"','" + atm.getCoordinates()
+"','" + atm.getCity()
+"','" + atm.getWebAddress()+ "');");
}
并且
public boolean atmExists(int atmId)
{
OpenIfNotOpened();
Cursor cursor = db.rawQuery("select 1 from " + AtmsTable.NAME +" where " + AtmsTable.COL_ID + "=" + atmId,null);
boolean exists = (cursor.getCount() > 0);
cursor.close();
return exists;
}
我收到以下错误消息
任何帮助将不胜感激。
friends,
i have written following sqlite insert statement which seems to be wrong.
before inserting row i am checking if record exists then dont insert(ATM data is more than 600 records)
Reached max size for compiled sql statement cache for database.no space for this sql statement in cache.select 1 from atm where atmid=251 please change your sql statment to use "?" for bindargs, instead of
public void addAtm(ATM atm)
{
db.execSQL("INSERT INTO " + AtmsTable.NAME +
"(" +AtmsTable.COL_ID + ","
+AtmsTable.COL_BankID +","
+ AtmsTable.COL_BankNAME+","
+ AtmsTable.COL_BankPhone+","
+ AtmsTable.COL_BankAddress+","
+ AtmsTable.COL_BankCoordinates+","
+ AtmsTable.COL_BankCity+","
+ AtmsTable.COL_BankWebaddress+") Values ("
+atm.getAtmID()+","
+atm.getBankID()
+ ",'" + atm.getBankName().trim()
+"','" + atm.getPhone()
+"','" + atm.getAddress()
+"','" + atm.getCoordinates()
+"','" + atm.getCity()
+"','" + atm.getWebAddress()+ "');");
}
and
public boolean atmExists(int atmId)
{
OpenIfNotOpened();
Cursor cursor = db.rawQuery("select 1 from " + AtmsTable.NAME +" where " + AtmsTable.COL_ID + "=" + atmId,null);
boolean exists = (cursor.getCount() > 0);
cursor.close();
return exists;
}
and i am getting following error message
any help would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只需使用:
just use: