sqllite 文件

image.png

image.png
查询语句

image.png
SELECT * FROM images WHERE tile_id in (SELECT tile_id FROM map where tile_column= ? and tile_row = ? and zoom_level = ?);
public byte[] queryMapImage(int x, int y, int zoom) {
MapInfo mapInfo = null;
openDB();
try {
String tile_column = String.valueOf(x);
String tile_row = String.valueOf(y);
String zoom_level = String.valueOf(zoom);
// String sql = "select * from map where tile_column= ? and tile_row = ? and zoom_level = ?";
String sql = "SELECT * FROM images WHERE tile_id in (SELECT tile_id FROM map where tile_column= ? and tile_row = ? and zoom_level = ?);";
Cursor cursor = mDB.rawQuery(sql, new String[]{tile_column, tile_row, zoom_level});
byte[] jpgData = null;
while (cursor.moveToNext()) {
String tile_id = cursor.getString(cursor.getColumnIndex("tile_id"));
jpgData = cursor.getBlob(cursor.getColumnIndex("tile_data"));
}
cursor.close();
return jpgData;
} catch (Exception e) {
e.printStackTrace();
LogUtils.e(e.toString());
}
return null;
}
调用传给web界面

image.png
网友评论