47         "    typeID, MIN(price) AS price, volRemaining, stationID " 
   69         "    typeID, MIN(price) AS price, volRemaining, stationID " 
   71         " WHERE solarSystemID=%u" 
   91         "    typeID, MIN(price) AS price, volRemaining, stationID " 
   93         " WHERE regionID=%u AND bid=%u" 
  118         "    price, volRemaining, typeID, orderRange AS `range`, orderID," 
  119         "   volEntered, minVolume, bid, issued as issueDate, duration," 
  120         "   stationID, regionID, solarSystemID, jumps" 
  127     _log(MARKET__DB_TRACE, 
"GetOrders() - Fetched %u sell orders for type %u", res.
GetRowCount(), typeID);
 
  133         "    price, volRemaining, typeID, orderRange AS `range`, orderID," 
  134         "   volEntered, minVolume, bid, issued as issueDate, duration," 
  135         "   stationID, regionID, solarSystemID, jumps" 
  137         " WHERE regionID=%u AND typeID=%u AND bid=%u", regionID, typeID, 
Market::Type::Buy))
 
  143     _log(MARKET__DB_TRACE, 
"GetOrders() - Fetched %u buy orders for type %u", res.
GetRowCount(), typeID);
 
  147         tup->
Dump(MARKET__DUMP, 
"    ");
 
  156         "   orderID, typeID, ownerID AS charID, regionID, stationID," 
  157         "   orderRange AS `range`, bid, price, volEntered, volRemaining," 
  158         "   issued as issueDate, minVolume, contraband," 
  159         "   duration, isCorp, solarSystemID, escrow" 
  161         " WHERE ownerID=%u", ownerID))
 
  167     _log(MARKET__DB_TRACE, 
"GetOrdersForOwner() - Fetched %u buy orders for %u", res.
GetRowCount(), ownerID);
 
  176         "   price, volRemaining, typeID, orderRange AS `range`, orderID," 
  177         "   volEntered, minVolume, bid, issued as issueDate, duration," 
  178         "   stationID, regionID, solarSystemID, jumps" 
  180         " WHERE orderID=%u", orderID))
 
  188         codelog(MARKET__ERROR, 
"Order %u not found.", orderID);
 
  204         "  AND volRemaining >= %u" 
  206         " ORDER BY price DESC" 
  233         "  AND volRemaining >= %u" 
  235         " ORDER BY price ASC" 
  279         _log(MARKET__WARNING, 
"Order %u not found.", orderID);
 
  300     if (!
sDatabase.RunQuery(err, 
"UPDATE mktOrders SET volRemaining = %u WHERE orderID = %u",  new_qty, orderID)) {
 
  301         _log(MARKET__DB_ERROR, 
"Error in query: %s.", err.
c_str());
 
  309     if (!
sDatabase.RunQuery(err, 
"UPDATE mktOrders SET price = %.2f WHERE orderID = %u", new_price, orderID)) {
 
  310         _log(MARKET__DB_ERROR, 
"Error in query: %s.", err.
c_str());
 
  318     if (!
sDatabase.RunQuery(err, 
"DELETE FROM mktOrders WHERE orderID = %u", orderID)) {
 
  319         _log(MARKET__DB_ERROR, 
"Error in query: %s.", err.
c_str());
 
  329         "INSERT INTO mktOrders (" 
  330         " typeID, ownerID, regionID, stationID, solarSystemID, orderRange," 
  331         " bid, price, escrow, minVolume, volEntered, volRemaining," 
  332         " issued, contraband, duration, jumps, isCorp, accountKey, memberID" 
  334         "    %u, %u, %u, %u, %u, %u," 
  335         "    %u, %.2f, %.2f, %u, %u, %u," 
  336         "    %li, %u, %u, %u, %u, %u, %u" 
  342         codelog(MARKET__DB_ERROR, 
"Error in query: %s", err.
c_str());
 
  352     std::string typeID = 
"";
 
  354         typeID = 
"AND typeID=";
 
  355         typeID += std::to_string(data.
typeID);
 
  357     std::string buy = 
"";
 
  358     if (data.
isBuy > -1) {
 
  359         buy = 
"AND transactionType=";
 
  360         buy += std::to_string(data.
isBuy);
 
  365         "   transactionID, transactionDate, typeID, keyID, quantity, price," 
  366         "   transactionType, clientID, regionID, stationID, corpTransaction, characterID" 
  367         " FROM mktTransactions " 
  368         " WHERE clientID=%u %s AND quantity>=%u AND price>=%.2f AND " 
  369         " transactionDate>=%li %s AND keyID=%u AND characterID=%u",
 
  387         "    transactionDate, typeID, keyID, quantity, price," 
  388         "    transactionType, clientID, regionID, stationID, corpTransaction, characterID" 
  390         " %f, %u, %u, %u, %f," 
  391         " %u, %u, %u, %u, %u, %u)",
 
  395         codelog(MARKET__DB_ERROR, 
"Error in query: %s", err.
c_str());
 
  404     if (!
sDatabase.RunQuery(res, 
"SELECT parentGroupID, marketGroupID, marketGroupName," 
  405         " description, graphicID, hasTypes, iconID, dataID, marketGroupNameID, descriptionID" 
  406         " FROM invMarketGroups"))  {
 
  413     _log(MARKET__DB_TRACE, 
"GetMarketGroups header has %u columns.", header->
ColumnCount());
 
  416     PyDict *keywords = filterRowset->GetKeywords();
 
  422     std::map< int, PyRep* > tt;
 
  423     while( res.
GetRow(row) ) {
 
  427         if (tt.count(parentGroupID)) {
 
  428             pid = tt[parentGroupID];
 
  429             rowset = filterRowset->GetRowset(pid);
 
  432             tt[parentGroupID] = pid;
 
  433             rowset = filterRowset->NewRowset(pid);
 
  449     _log(MARKET__DB_TRACE, 
"GetMarketGroups returned %u keys.", filterRowset->GetKeyCount());
 
  451         filterRowset->Dump(MARKET__DB_TRACE, 
"    ");
 
  459     if (!
sDatabase.RunQuery(res, 
"SELECT timeStamp FROM mktUpdates WHERE server = 1"))  {
 
  473     sDatabase.RunQuery(err, 
"UPDATE mktUpdates SET timeStamp = %li WHERE server = 1", setTime);
 
  484                    "     (regionID, typeID, historyDate, lowPrice, highPrice, avgPrice, volume, orders)" 
  488                    "    ((UNIX_TIMESTAMP(date) + 11644473600) * 10000000)," 
  493                    "    COUNT(DISTINCT typeID)" 
  507                 " FROM invTypes AS t " 
  508                 " LEFT JOIN invGroups AS g USING (groupID)" 
  509                 " WHERE g.categoryID = %u",
 
  524     if (!
sDatabase.RunQuery(res, 
"SELECT DISTINCT typeID FROM invTypeMaterials"))
 
  525         codelog(DATABASE__ERROR, 
"Error in GetRAMMaterials query: %s", res.
error.
c_str());
 
  535     std::map< uint16, Market::matlData >::iterator itr;
 
  536     for (itr = data.begin(); itr != data.end(); ++itr) {
 
  537         sDatabase.RunQuery(res, 
"SELECT basePrice FROM invTypes WHERE typeID = %u", itr->first);
 
  539             itr->second.price = (row.
GetFloat(0) * 1.05);
 
  547     std::map< uint16, Market::matlData >::iterator itr;
 
  548     for (itr = data.begin(); itr != data.end(); ++itr) {
 
  549         sDatabase.RunQuery(res, 
"SELECT basePrice FROM invTypes WHERE typeID = %u", itr->first);
 
  551             itr->second.price = (row.
GetFloat(0) * 1.15);
 
  573     for (
auto cur : data) {
 
  574         if (cur.second.basePrice < 0.01) {
 
  575             sLog.Error(
"     SetBasePrice", 
"Calculated price for %s(%u) is 0", \
 
  576                     cur.second.name.c_str(), cur.first);
 
  578             sDatabase.RunQuery(err, 
"UPDATE invTypes SET basePrice=%f WHERE typeID= %u", cur.second.basePrice, cur.first);
 
  586     for (
auto cur : data)
 
  587         sDatabase.RunQuery(err, 
"UPDATE invTypes SET basePrice=%f WHERE typeID= %u", cur.second.price, cur.first);
 
  594     std::map< uint16, Inv::TypeData>::iterator itr;
 
  595     for (itr = data.begin(); itr != data.end(); ++itr) {
 
  596         sDatabase.RunQuery(res, 
"SELECT AVG(avgPrice) FROM CruciblePriceHistory WHERE typeID = %u", itr->first);
 
PyRep * GetRegionBest(uint32 regionID)
 
bool GetOrderInfo(uint32 orderID, Market::OrderInfo &oInfo)
 
const char * GetText(uint32 index) const 
 
#define _log(type, fmt,...)
 
float GetFloat(uint32 index) const 
 
PyObjectEx * DBResultToCRowset(DBQueryResult &result)
 
int32 GetInt(uint32 index) const 
 
Python object "dbutil.CFilterRowset". 
 
PyRep * GetOrdersForOwner(uint32 ownerID)
 
PyRep * GetStationAsks(uint32 stationID)
 
PyRep * GetTransactions(uint32 ownerID, Market::TxData &data)
 
PyRep * GetMarketGroups()
 
uint32 GetUInt(uint32 index) const 
 
PyRep * GetOrders(uint32 regionID, uint16 typeID)
 
static void GetMineralPrices(std::map< uint16, Market::matlData > &data)
 
static void UpdateInvPrice(std::map< uint16, Inv::TypeData > &data)
 
bool AlterOrderPrice(uint32 orderID, double new_price)
 
void Dump(FILE *into, const char *pfx) const 
Dumps object to file. 
 
bool GetRow(DBResultRow &into)
 
bool GetBool(uint32 index) const 
 
#define is_log_enabled(type)
 
#define sLog
Evaluates to a NewLog instance. 
 
const char * c_str() const 
 
Python object "blue.DBRowDescriptor". 
 
uint32 ColumnCount() const 
 
PyRep * GetOrderRow(uint32 orderID)
 
#define codelog(type, fmt,...)
 
void SetItem(size_t index, PyRep *object)
Stores Python object. 
 
Python object "dbutil.CRowset". 
 
PyObject * DBResultToRowset(DBQueryResult &result)
 
bool IsNull(uint32 index) const 
 
static void GetShipIDs(std::map< uint16, Inv::TypeData > &data)
 
static void GetCruPriceAvg(std::map< uint16, Inv::TypeData > &data)
 
bool RecordTransaction(Market::TxData &data)
 
static void SetUpdateTime(int64 setTime)
 
uint32 FindBuyOrder(Call_PlaceCharOrder &call)
 
PyObject * DBResultToIndexRowset(DBQueryResult &result, const char *key)
 
static void GetMaterialPrices(std::map< uint16, Market::matlData > &data)
 
static void GetManufacturedItems(std::map< uint16, Inv::TypeData > &data)
 
bool SetField(uint32 index, PyRep *value)
 
bool AlterOrderQuantity(uint32 orderID, uint32 new_qty)
 
PyPackedRow * DBRowToPackedRow(DBResultRow &row)
 
bool DeleteOrder(uint32 orderID)
 
uint32 StoreOrder(Market::SaveData &data)
 
int64 GetInt64(uint32 index) const 
 
PyRep * GetSystemAsks(uint32 solarSystemID)
 
static void UpdateMktPrice(std::map< uint16, Market::matlData > &data)
 
void SetItemString(const char *key, PyRep *value)
SetItemString adds or sets a database entry. 
 
static void UpdateHistory()
 
uint32 FindSellOrder(Call_PlaceCharOrder &call)
 
static int64 GetUpdateTime()