+
+void setup_value(void) {
+ SQL_MUST( sqlite3_prepare(db,
+ "SELECT\n"
+ " sell.commodid commodid,\n"
+ " sell.price src_price,\n"
+ " sum(sell.qty) src_qty,\n"
+ " buy.price dst_price,\n"
+ " sum(buy.qty) dst_qty\n"
+ " FROM sell JOIN buy\n"
+ " ON sell.commodid = buy.commodid\n"
+ " AND buy.price > sell.price\n"
+ " WHERE sell.islandid=?\n"
+ " AND buy.islandid=?\n"
+ " GROUP BY sell.commodid, sell.price, buy.price",
+ -1, &ss_ipair, 0) );
+
+ ipairs= mcalloc(sizeof(*ipairs) * nislands);
+}