Esempio n. 1
0
PyPackedRow *StationDB::GetSolarSystem(uint32 solarSystemID) {
    DBQueryResult res;

    if(!sDatabase.RunQuery(res,
        "SELECT "
        " solarSystemID,"            // nr
        " solarSystemName,"            // string
        " x, y, z,"                    // double
        " radius,"                    // double
        " security,"                // double
        " constellationID,"            // nr
        " factionID,"                // nr
        " sunTypeID,"                // nr
        " regionID,"
        " 0 AS wormholeClassID"
        " FROM mapSolarSystems"
        " WHERE solarSystemID=%u", solarSystemID
    ))
    {
        _log(SERVICE__ERROR, "Error in GetSolarSystem query: %s", res.error.c_str());
        return NULL;
    }

    DBResultRow row;
    if(!res.GetRow(row)) {
        _log(SERVICE__ERROR, "Error in GetSolarSystem query: no solarsystem for id %d", solarSystemID);
        return NULL;
    }

    return(DBRowToPackedRow(row));
}
Esempio n. 2
0
PyRep *MarketDB::GetContract( uint32 contractID )
{
	DBQueryResult res;
	if(!sDatabase.RunQuery(res,
		"SELECT"
		" contractID,"
		" issuerID,"
		" issuerCorpID,"
		" type,"
		" avail AS availability,"
		" assigneeID,"
		" expiretime,"
		" duration AS numDays,"
		" startStationID,"
		" endStationID,"
		" startSolarSystemID,"
		" endSolarSystemID,"
		" startRegionID,"
		" endRegionID,"
		" price,"
		" reward,"
		" collateral,"
		" title,"
		" description,"
		" forCorp,"
		" status,"
		" isAccepted,"
		" acceptorID,"
		" dateIssued,"
		" dateExpired,"
		" dateAccepted,"
		" dateCompleted,"
		" volume"
		" FROM contract"
		" WHERE contractID=%d", contractID ))
	{
		codelog(MARKET__ERROR, "Error in query: %s", res.error.c_str() );
		return NULL;
	}

	DBResultRow row;
	if(!res.GetRow(row)) {
		codelog(MARKET__ERROR, "Contract %d not found.", contractID);
		return NULL;
	}

	return(DBRowToPackedRow(row));
}
Esempio n. 3
0
PyRep *MarketDB::GetOrderRow(uint32 orderID) {
    DBQueryResult res;

    if(!sDatabase.RunQuery(res,
        "SELECT"
        "    price, volRemaining, typeID, `range`, orderID,"
        "   volEntered, minVolume, bid, issued as issueDate, duration,"
        "   stationID, regionID, solarSystemID, jumps"
        " FROM market_orders"
        " WHERE orderID=%u", orderID))
    {
        codelog(MARKET__ERROR, "Error in query: %s", res.error.c_str());
        return NULL;
    }

    DBResultRow row;
    if(!res.GetRow(row)) {
        codelog(MARKET__ERROR, "Order %u not found.", orderID);
        return NULL;
    }

    return(DBRowToPackedRow(row));
}