我有以下代码,第一个游标对象工作正常,但当我做另一个查询并将其分配给flightCursor时,它给出了错误.
Cursor cursor = database.query( CityAndAirportsTable.notificationsTable, new String[] { CityAndAirportsTable.notifyFlightId },
null, null, null, null, "Id DESC" );
cursor.moveToFirst();
while( !cursor.isAfterLast() ){
String id = String.valueOf( cursor.getInt( 0 ) );
Cursor flightCursor = database.query( CityAndAirportsTable.flightTable, new String[] { CityAndAirportsTable.fromDestinationCode,
CityAndAirportsTable.toDestinationCode, CityAndAirportsTable.currentPrice }, CityAndAirportsTable.flightId + "=" + id,
null, null, null, null );
}
Run Code Online (Sandbox Code Playgroud)
这里的flightCursor = database.query,我得到错误.
日志
03-27 23:49:09.628: E/SQLiteLog(2296): (14) cannot open file at line 30046 of [9491ba7d73]
03-27 23:49:09.628: E/SQLiteLog(2296): (14) os_unix.c:30046: (24) open(/data/data/com.flightapp.myapp/databases/Application_DB-journal) -
03-27 23:49:09.628: E/SQLiteLog(2296): …Run Code Online (Sandbox Code Playgroud) 为了将shared_ptr分配给柠檬图库中的Graph类型变量,我这样做了:
typedef ListDigraph Graph;
typedef std::shared_ptr<Graph> Process_pointer;
Process_pointer process(new Graph);
Run Code Online (Sandbox Code Playgroud)
它运行正常,但现在我需要为地图对象声明一个shared_ptr,通常地图对象的工作方式如下:
Graph process;
typedef ListDigraph::NodeMap<string> Node_names;
Node_names name(process);
Run Code Online (Sandbox Code Playgroud)
也就是说,name需要Graph对象作为其默认构造函数.
为了声明一个shared_ptr,我这样做了:
typedef ListDigraph::NodeMap<string> Node_names;
typedef std::shared_ptr<Node_names> Nname_pointer;
Nname_pointer name = new Node_names;
name(process);
Run Code Online (Sandbox Code Playgroud)
我知道,名称的声明是错误的,但我如何分配内存以及用进程对象初始化它.