PyRep *MarketDB::GetContractItemsForOwner( uint32 characterID ) { DBQueryResult res; if(!sDatabase.RunQuery(res, "SELECT itemID, contractID, quantity, flag, typeID, get" " FROM contracts_items" " WHERE characterID=%d", characterID )) { codelog(MARKET__ERROR, "Error in query: %s", res.error.c_str() ); return NULL; } return DBResultToIndexRowset( res, "contractID" ); }
PyRep *CorporationDB::GetApplications(uint32 corpID) { DBQueryResult res; if (!sDatabase.RunQuery(res, " SELECT " " corporationID, characterID, applicationText, roles, grantableRoles, status, " " applicationDateTime, deleted, lastCorpUpdaterID " " FROM chrApplications " " WHERE corporationID = %u ", corpID)) { codelog(SERVICE__ERROR, "Error in query: %s", res.error.c_str()); return NULL; } return DBResultToIndexRowset(res, "characterID"); }
PyObject *ConfigDB::GetUnits() { DBQueryResult res; if(!sDatabase.RunQuery(res, "SELECT " " unitID,unitName,displayName" " FROM eveUnits ")) { codelog(SERVICE__ERROR, "Error in query: %s", res.error.c_str()); return NULL; } return(DBResultToIndexRowset(res, "unitID")); }
PyObject *DBResultToIndexRowset(DBQueryResult &result, const char *key) { uint32 cc = result.ColumnCount(); uint32 key_index; for(key_index = 0; key_index < cc; key_index++) if(strcmp(key, result.ColumnName(key_index)) == 0) break; if(key_index == cc) { sLog.Error("EVEDBUtils", "DBResultToIndexRowset | Failed to find key column '%s' in result for IndexRowset", key); return NULL; } return DBResultToIndexRowset(result, key_index); }
PyRep *CertificateMgrDB::GetCertificateCategories() { DBQueryResult res; if(!sDatabase.RunQuery(res, "SELECT" " categoryID," " categoryName," " description," " 0 AS dataID" " FROM crtCategories")) { _log(DATABASE__ERROR, "Failed to query certificate categories: %s.", res.error.c_str()); return(NULL); } return(DBResultToIndexRowset(res, "categoryID")); }
PyRep *CertificateMgrDB::GetCertificateCategories() { DBQueryResult res; if(!DBcore::RunQuery(res, "SELECT" " crtCategories.categoryID," " categoryName," " description," " dataID," " categoryNameID " " FROM crtCategories" " LEFT JOIN extCrtCategories USING(categoryID)")) { _log(DATABASE__ERROR, "Failed to query certificate categories: %s.", res.error.c_str()); return(NULL); } return(DBResultToIndexRowset(res, "categoryID")); }
PyRep *MarketDB::GetRegionBest(uint32 regionID) { DBQueryResult res; if(!sDatabase.RunQuery(res, "SELECT" " typeID, MIN(price) AS price, volRemaining, stationID " " FROM market_orders " " WHERE regionID=%u AND bid=%d" //" WHERE regionID=%u" " GROUP BY typeID", regionID, TransactionTypeSell)) { codelog(MARKET__ERROR, "Error in query: %s", res.error.c_str()); return NULL; } //NOTE: this SHOULD return a crazy dbutil.RowDict object which is //made up of packed blue.DBRow objects, but we do not understand //the marshalling of those well enough right now, and this object //provides the same interface. It is significantly bigger on the wire though. return(DBResultToIndexRowset(res, "typeID")); }