【发布时间】:2013-10-20 10:17:23
【问题描述】:
我必须在 Titanium Mobile 中关闭结果集,然后再创建一个新结果集,还是在没有引用它时它会自动“关闭”?
例如,这样的东西是否安全且无内存泄漏?
var db = db.open("db_name");
var rs = db.execute("SELECT * FROM table");
while(rs.isValidRow()){ /* working with the resuls... */ }
// I make another select before closing the previous (current) results set
rs = db.execute("SELECT * FROM another_table");
while(rs.isValidRow()){ /* working with the results... */ }
// Once I am completely done I close the RS and DB
rs.close();
db.close();
或者每次需要新选择时我都必须关闭结果集。
var db = db.open("db_name");
var rs = db.execute("SELECT * FROM table");
while(rs.isValidRow()){ /* working with the resuls... */ }
// Close RS and then initialize a new one
rs.close();
rs = db.execute("SELECT * FROM another_table");
while(rs.isValidRow()){ /* working with the resuls... */ }
rs.close();
db.close();
【问题讨论】:
标签: database titanium resultset