wallet/wallet.c
static enum invoice_status wallet_invoice_db_state(
		struct db *db, const struct invoice *inv)
{
	sqlite3_stmt *stmt;
	int res;
	int state;

	stmt = db_prepare(db, "SELECT state FROM invoices WHERE id=?;");

	sqlite3_bind_int64(stmt, 1, inv->id);

	res = sqlite3_step(stmt);
	assert(res == SQLITE_ROW);
	state = sqlite3_column_int(stmt, 0);
	res = sqlite3_step(stmt);
	assert(res == SQLITE_DONE);

	sqlite3_finalize(stmt);
	return (enum invoice_status) state;
}
/* Determine the on-database state of an invoice. */
Determine the on-database state of an invoice.
Determine the on - database state of an invoice .
static enum invoice_status wallet_invoice_db_state(
		struct db *db, const struct invoice *inv)
{
	sqlite3_stmt *stmt;
	int res;
	int state;
	stmt = db_prepare(db, "SELECT state FROM invoices WHERE id=?;");
	sqlite3_bind_int64(stmt, 1, inv->id);
	res = sqlite3_step(stmt);
	assert(res == SQLITE_ROW);
	state = sqlite3_column_int(stmt, 0);
	res = sqlite3_step(stmt);
	assert(res == SQLITE_DONE);
	sqlite3_finalize(stmt);
	return (enum invoice_status) state;
}
static enum invoice_status wallet_invoice_db_state ( struct db * db , const struct invoice * inv ) { sqlite3_stmt * stmt ; int res ; int state ; stmt = db_prepare ( db , " " ) ; sqlite3_bind_int64 ( stmt , 1 , inv -> id ) ; res = sqlite3_step ( stmt ) ; assert ( res == SQLITE_ROW ) ; state = sqlite3_column_int ( stmt , 0 ) ; res = sqlite3_step ( stmt ) ; assert ( res == SQLITE_DONE ) ; sqlite3_finalize ( stmt ) ; return ( enum invoice_status ) state ; }
Determine the on-database state of an invoice.
Determine the on - database state of an invoice .