PyObjectEx *BookmarkDB::GetBookmarks(uint32 ownerID) {
	DBQueryResult res;

	if(!sDatabase.RunQuery(res,
		"SELECT"
		" CAST(bookmarkID AS SIGNED INTEGER) AS bookmarkID,"
		" CAST(ownerID AS SIGNED INTEGER) AS ownerID,"
        " CAST(itemID AS SIGNED INTEGER) AS itemID,"
		" CAST(typeID AS SIGNED INTEGER) AS typeID,"
		" memo,"
		" created,"
		" x, y, z,"
		" CAST(locationID AS SIGNED INTEGER) AS locationID,"
        " note,"
		" creatorID,"
		" folderID"
		" FROM bookmarks"
		" WHERE ownerID = %u",
		ownerID))
	{
        sLog.Error( "BookmarkDB::GetBookmarks()", "Failed to query bookmarks for owner %u: %s.", ownerID, res.error.c_str() );
		return(NULL);
	}

	return DBResultToCRowset(res);
}
Beispiel #2
0
PyRep* MailDB::GetNewMail(int charId)
{
    DBQueryResult res;
    if (!sDatabase.RunQuery(res, "SELECT messageID, senderID, toCharacterIDs, toListID, toCorpOrAllianceID, title, sentDate FROM mailMessage WHERE toCharacterIDs LIKE '%%%u%%'", charId))
        return NULL;
    return DBResultToCRowset(res);
}
PyRep *CharacterDB::GetCharSelectInfo(uint32 characterID) {
    DBQueryResult res;

    uint32 worldSpaceID = 0;

    // "SELECT itemName, typeID FROM entity WHERE itemID = (SELECT locationID FROM entity WHERE itemID = %u)", characterID
    std::string shipName = "My Ship";
    uint32 shipTypeID = 606;

    uint32 unreadMailCount = 0;
    uint32 upcomingEventCount = 0;
    uint32 unprocessedNotifications = 0;
    uint32 daysLeft = 14;
    uint32 userType = 23;
    uint64 skillQueueEndTime = ( Win32TimeNow() + (5*Win32Time_Hour) + (25*Win32Time_Minute) );
    uint64 allianceMemberStartDate = Win32TimeNow() - 15*Win32Time_Day;
    uint64 startDate = Win32TimeNow() - 24*Win32Time_Day;

    if(!sDatabase.RunQuery(res,
                           "SELECT "
                           " itemName AS shortName,bloodlineID,gender,bounty,character_.corporationID,allianceID,title,startDateTime,createDateTime,"
                           " securityRating,character_.balance,character_.stationID,solarSystemID,constellationID,regionID,"
                           " petitionMessage,logonMinutes,tickerName, %u AS worldSpaceID, '%s' AS shipName, %u AS shipTypeID, %u AS unreadMailCount, %u AS upcomingEventCount, %u AS unprocessedNotifications, %u AS daysLeft, %u AS userType, 0 AS paperDollState, 0 AS newPaperdollState, 0 AS oldPaperdollState, skillPoints, " I64u " AS skillQueueEndTime, " I64u " AS allianceMemberStartDate, " I64u " AS startDate"
                           " FROM character_ "
                           "	LEFT JOIN entity ON characterID = itemID"
                           "	LEFT JOIN corporation USING (corporationID)"
                           "	LEFT JOIN bloodlineTypes USING (typeID)"
                           " WHERE characterID=%u", worldSpaceID, shipName.c_str(), shipTypeID, unreadMailCount, upcomingEventCount, unprocessedNotifications, daysLeft, userType, skillQueueEndTime, allianceMemberStartDate, startDate, characterID))
    {
        codelog(SERVICE__ERROR, "Error in query: %s", res.error.c_str());
        return NULL;
    }

    return DBResultToCRowset(res);
}
PyRep *ItemDB::ListStationItems( uint32 characterID, uint32 stationID )
{
	DBQueryResult res;

	if( !sDatabase.RunQuery( res,
		"SELECT itemID,"
		" entity.typeID,"
		" quantity,"
		" locationID,"
		" flag,"
		" singleton,"
		" contraband,"
		" invGroups.categoryID,"
		" invTypes.groupID"
		" FROM entity"
		" LEFT JOIN invTypes ON entity.typeID = invTypes.typeID"
		" LEFT JOIN invGroups ON invTypes.groupID = invGroups.groupID"
		" WHERE ownerID=%u"
		" AND locationID=%u"
		" AND flag=4", characterID, stationID ))
	{
		_log(DATABASE__ERROR, "Cant find items for character %u in station %u", characterID, stationID );
		return NULL;
	}

	return DBResultToCRowset( res );
}
Beispiel #5
0
PyRep *MarketDB::GetOldPriceHistory(uint32 regionID, uint32 typeID) {
    DBQueryResult res;

    /*DBColumnTypeMap colmap;
    colmap["historyDate"] = DBTYPE_FILETIME;
    colmap["lowPrice"] = DBTYPE_CY;
    colmap["highPrice"] = DBTYPE_CY;
    colmap["avgPrice"] = DBTYPE_CY;
    colmap["volume"] = DBTYPE_I8;
    colmap["orders"] = DBTYPE_I4;

    //ordering: (painstakingly determined from packets)
    DBColumnOrdering ordering;
    ordering.push_back("historyDate");
    ordering.push_back("lowPrice");
    ordering.push_back("highPrice");
    ordering.push_back("avgPrice");
    ordering.push_back("volume");
    ordering.push_back("orders");*/

    if(!sDatabase.RunQuery(res,
        "SELECT"
        "    historyDate, lowPrice, highPrice, avgPrice,"
        "    volume, orders "
        " FROM market_history_old "
        " WHERE regionID=%u AND typeID=%u", regionID, typeID))
    {
        codelog(MARKET__ERROR, "Error in query: %s", res.error.c_str());
        return NULL;
    }

    return(DBResultToCRowset(res));
}
Beispiel #6
0
PyRep* MailDB::GetMailStatus(int charId)
{
    DBQueryResult res;
    if (!sDatabase.RunQuery(res, "SELECT messageID, statusMask, labelMask FROM mailMessage WHERE toCharacterIDs LIKE '%%%u%%'", charId))
        return NULL;
    return DBResultToCRowset(res);
}
Beispiel #7
0
PyObjectEx *BookmarkDB::GetBookmarks(uint32 ownerID) {
    DBQueryResult res;

    if(!DBcore::RunQuery(res,
        "SELECT"
        " bookmarkID,"
        " ownerID,"
        " itemID,"
        " typeID,"
        " memo,"
        " created,"
        " x, y, z,"
        " locationID,"
        " note,"
        " creatorID,"
        " folderID"
        " FROM srvBookmarks"
        " WHERE ownerID = %u",
        ownerID))
    {
        SysLog::Error( "BookmarkDB::GetBookmarks()", "Failed to query bookmarks for owner %u: %s.", ownerID, res.error.c_str() );
        return(NULL);
    }

    return DBResultToCRowset(res);
}
PyRep *ObjCacheDB::Generate_invTypes()
{
	DBQueryResult res;
	const char *q = "SELECT typeID, groupID, typeName, description, graphicID, radius, mass, volume, capacity, portionSize, raceID, basePrice, published, marketGroupID, chanceOfDuplicating, soundID, categoryID, iconID, dataID FROM invTypes";
	if(sDatabase.RunQuery(res, q)==false)
	{
		_log(SERVICE__ERROR, "Error in query for cached object 'config.BulkData.types': %s", res.error.c_str());
		return NULL;
	}

	DBRowDescriptor* header = new DBRowDescriptor;
	header->AddColumn("typeID", DBTYPE_I4);
	header->AddColumn("groupID", DBTYPE_I2);
	header->AddColumn("typeName", DBTYPE_WSTR);
	header->AddColumn("description", DBTYPE_WSTR);
	header->AddColumn("graphicID", DBTYPE_I4);
	header->AddColumn("radius", DBTYPE_R8);
	header->AddColumn("mass", DBTYPE_R8);
	header->AddColumn("volume", DBTYPE_R8);
	header->AddColumn("capacity", DBTYPE_R8);
	header->AddColumn("portionSize", DBTYPE_I4);
	header->AddColumn("raceID", DBTYPE_UI1);
	header->AddColumn("basePrice", DBTYPE_CY);
	header->AddColumn("published", DBTYPE_BOOL);
	header->AddColumn("marketGroupID", DBTYPE_I2);
	header->AddColumn("chanceOfDuplicating", DBTYPE_R8);
	header->AddColumn("soundID", DBTYPE_I4);
	header->AddColumn("categoryID", DBTYPE_I2);
	header->AddColumn("iconID", DBTYPE_I4);
	header->AddColumn("dataID", DBTYPE_I4);

	return DBResultToCRowset(res, header);
}
Beispiel #9
0
PyObjectEx *MissionDB::GetAgents() {
	DBQueryResult res;

	if(!sDatabase.RunQuery(res,
		"SELECT"
		"	agt.agentID,"
		"	agt.agentTypeID,"
		"	agt.divisionID,"
		"	agt.level,"
		"	chr.stationID,"
		"	agt.quality,"
		"	agt.corporationID,"
		"	bl.bloodlineID,"
		"	chr.gender"
		" FROM agtAgents AS agt"
		" LEFT JOIN characterstatic AS chr ON chr.characterID = agt.agentID"
		" LEFT JOIN bloodlineTypes AS bl ON bl.bloodlineID = agt.agentTypeID"
	))
	{
		codelog(SERVICE__ERROR, "Error in query: %s", res.error.c_str());
		return NULL;
	}
	
	return(DBResultToCRowset(res));
}
Beispiel #10
0
PyRep *ObjCacheDB::Generate_eveGraphics()
{
	DBQueryResult res;
	const char *q = "SELECT graphicID, graphicFile, graphicName, description, obsolete, graphicType, collisionFile, paperdollFile, animationTemplate, collidable, explosionID, directoryID, graphicMinX, graphicMinY, graphicMinZ, graphicMaxX, graphicMaxY, graphicMaxZ from graphics";
	if(sDatabase.RunQuery(res, q)==false)
	{
		_log(SERVICE__ERROR, "Error in query for cached object 'config.BulkData.graphics': %s", res.error.c_str());
		return NULL;
	}
	
	DBRowDescriptor* header = new DBRowDescriptor;
	header->AddColumn("graphicID", DBTYPE_I4);
	header->AddColumn("graphicFile", DBTYPE_STR);
	header->AddColumn("graphicName", DBTYPE_STR);
	header->AddColumn("description", DBTYPE_WSTR);
	header->AddColumn("obsolete", DBTYPE_BOOL);
	header->AddColumn("graphicType", DBTYPE_STR);
	header->AddColumn("collisionFile", DBTYPE_STR);
	header->AddColumn("paperdollFile", DBTYPE_STR);
	header->AddColumn("animationTemplate", DBTYPE_I4);
	header->AddColumn("collidable", DBTYPE_BOOL);
	header->AddColumn("explosionID", DBTYPE_I4);
	header->AddColumn("directoryID", DBTYPE_I4);
	header->AddColumn("graphicMinX", DBTYPE_R8);
	header->AddColumn("graphicMinY", DBTYPE_R8);
	header->AddColumn("graphicMinZ", DBTYPE_R8);
	header->AddColumn("graphicMaxX", DBTYPE_R8);
	header->AddColumn("graphicMaxY", DBTYPE_R8);
	header->AddColumn("graphicMaxZ", DBTYPE_R8);


	return DBResultToCRowset(res, header);
}
Beispiel #11
0
PyRep *ObjCacheDB::Generate_c_chrSchools()
{
	DBQueryResult res;
	const char *q = "SELECT raceID, schoolID, schoolName, description, graphicID, chrSchools.corporationID, chrSchools.agentID, newAgentID, iconID FROM chrSchools LEFT JOIN agtAgents USING (corporationID) GROUP BY schoolID";
	if(sDatabase.RunQuery(res, q)==false)
	{
		_log(SERVICE__ERROR, "Error in query for cached object 'charCreationInfo.schools': %s", res.error.c_str());
		return NULL;
	}
	return DBResultToCRowset(res);
}
Beispiel #12
0
PyRep *ObjCacheDB::Generate_c_chrAncestries()
{
	DBQueryResult res;
	const char *q = "SELECT ancestryID, ancestryName, bloodlineID, description, perception, willpower, charisma, memory, intelligence, iconID, iconID AS graphicID, shortDescription, 0 AS dataID FROM chrAncestries";
	if(sDatabase.RunQuery(res, q)==false)
	{
		_log(SERVICE__ERROR, "Error in query for cached object 'charCreationInfo.ancestries': %s", res.error.c_str());
		return NULL;
	}
	return DBResultToCRowset(res);
}
Beispiel #13
0
PyRep *ObjCacheDB::Generate_invContrabandTypes()
{
	DBQueryResult res;
	const char *q = "SELECT factionID, typeID, standingLoss, confiscateMinSec, fineByValue, attackMinSec FROM invContrabandTypes";
	if(sDatabase.RunQuery(res, q)==false)
	{
		_log(SERVICE__ERROR, "Error in query for cached object 'config.InvContrabandTypes': %s", res.error.c_str());
		return NULL;
	}
	return DBResultToCRowset(res);
}
Beispiel #14
0
PyRep *ObjCacheDB::Generate_eveStaticLocations()
{
	DBQueryResult res;
	const char *q = "SELECT locationID, locationName, x, y, z FROM eveStaticLocations";
	if(sDatabase.RunQuery(res, q)==false)
	{
		_log(SERVICE__ERROR, "Error in query for cached object 'config.StaticLocations': %s", res.error.c_str());
		return NULL;
	}
	return DBResultToCRowset(res);
}
Beispiel #15
0
PyRep *ObjCacheDB::Generate_cacheOwners()
{
	DBQueryResult res;
	const char *q = "SELECT ownerID, ownerName, typeID FROM cacheOwners";
	if(sDatabase.RunQuery(res, q)==false)
	{
		_log(SERVICE__ERROR, "Error in query for cached object 'config.BulkData.owners': %s", res.error.c_str());
		return NULL;
	}
	return DBResultToCRowset(res);
}
Beispiel #16
0
PyRep *ObjCacheDB::Generate_certificates()
{
	DBQueryResult res;
	const char *q = "SELECT certificateID, categoryID, classID, grade, iconID, corpID, description, 0 AS dataID FROM crtCertificates";
	if(sDatabase.RunQuery(res, q)==false)
	{
		_log(SERVICE__ERROR, "Error in query for cached object 'config.BulkData.certificates': %s", res.error.c_str());
		return NULL;
	}
	return DBResultToCRowset(res);
}
Beispiel #17
0
PyRep *ObjCacheDB::Generate_bl_beards()
{
	DBQueryResult res;
	const char *q = "SELECT bloodlineID, gender, beardID FROM chrBLBeards";
	if(sDatabase.RunQuery(res, q)==false)
	{
		_log(SERVICE__ERROR, "Error in query for cached object 'charCreationInfo.bl_beards': %s", res.error.c_str());
		return NULL;
	}
	return DBResultToCRowset(res);
}
Beispiel #18
0
PyRep *ObjCacheDB::Generate_invBlueprintTypes()
{
	DBQueryResult res;
	const char *q = "SELECT blueprintTypeID, parentBlueprintTypeID, productTypeID, productionTime, techLevel, researchProductivityTime, researchMaterialTime, researchCopyTime, researchTechTime, productivityModifier, materialModifier, wasteFactor, chanceOfReverseEngineering, maxProductionLimit FROM bpTypes";
	if(sDatabase.RunQuery(res, q)==false)
	{
		_log(SERVICE__ERROR, "Error in query for cached object 'config.BulkData.bptypes': %s", res.error.c_str());
		return NULL;
	}
	return DBResultToCRowset(res);
}
Beispiel #19
0
PyRep *ObjCacheDB::Generate_locationWormholeClasses()
{
	DBQueryResult res;
	const char *q = "SELECT locationID, wormholeClassID FROM mapLocationWormholeClasses";
	if(sDatabase.RunQuery(res, q)==false)
	{
		_log(SERVICE__ERROR, "Error in query for cached object 'config.BulkData.locationwormholeclasses': %s", res.error.c_str());
		return NULL;
	}
	return DBResultToCRowset(res);
}
Beispiel #20
0
PyRep *ObjCacheDB::Generate_invShipTypes()
{
	DBQueryResult res;
	const char *q = "SELECT shipTypeID, weaponTypeID, miningTypeID, skillTypeID FROM shipTypes";
	if(sDatabase.RunQuery(res, q)==false)
	{
		_log(SERVICE__ERROR, "Error in query for cached object 'config.BulkData.shiptypes': %s", res.error.c_str());
		return NULL;
	}
	return DBResultToCRowset(res);
}
Beispiel #21
0
PyRep *ObjCacheDB::Generate_certificateRelationships()
{
	DBQueryResult res;
	const char *q = "SELECT relationshipID, parentID, parentTypeID, parentLevel, childID, childTypeID FROM certificateRelationShips";
	if(sDatabase.RunQuery(res, q)==false)
	{
		_log(SERVICE__ERROR, "Error in query for cached object 'config.BulkData.certificaterelationships': %s", res.error.c_str());
		return NULL;
	}
	return DBResultToCRowset(res);
}
Beispiel #22
0
PyRep *ObjCacheDB::Generate_c_chrAttributes()
{
	DBQueryResult res;
	const char *q = "SELECT attributeID, attributeName, description, iconID, iconID as graphicID, shortDescription, notes FROM chrAttributes";
	if(sDatabase.RunQuery(res, q)==false)
	{
		_log(SERVICE__ERROR, "Error in query for cached object 'charCreationInfo.attributes': %s", res.error.c_str());
		return NULL;
	}
	return DBResultToCRowset(res);
}
Beispiel #23
0
PyRep *ObjCacheDB::Generate_bl_lights()
{
	DBQueryResult res;
	const char *q = "SELECT lightID, lightName FROM chrBLLights";
	if(sDatabase.RunQuery(res, q)==false)
	{
		_log(SERVICE__ERROR, "Error in query for cached object 'charCreationInfo.bl_lights': %s", res.error.c_str());
		return NULL;
	}
	return DBResultToCRowset(res);
}
Beispiel #24
0
PyRep *ObjCacheDB::Generate_tickerNames()
{
	DBQueryResult res;
	const char *q = "SELECT corporationID,tickerName,shape1,shape2,shape3,color1,color2,color3 FROM corporation WHERE hasPlayerPersonnelManager=0";
	if(sDatabase.RunQuery(res, q)==false)
	{
		_log(SERVICE__ERROR, "Error in query for cached object 'config.BulkData.tickernames': %s", res.error.c_str());
		return NULL;
	}
	return DBResultToCRowset(res);
}
Beispiel #25
0
PyRep *ObjCacheDB::Generate_ramTypeRequirements()
{
	DBQueryResult res;
	const char *q = "SELECT typeID, activityID, requiredTypeID, quantity, damagePerJob, recycle FROM ramTypeRequirements";
	if(sDatabase.RunQuery(res, q)==false)
	{
		_log(SERVICE__ERROR, "Error in query for cached object 'config.BulkData.ramtyperequirements': %s", res.error.c_str());
		return NULL;
	}
	return DBResultToCRowset(res);
}
Beispiel #26
0
PyRep *ObjCacheDB::Generate_invGroups()
{
	DBQueryResult res;
	const char *q = "SELECT groupID, categoryID, groupName, description, iconID, 0 as graphicID, useBasePrice, allowManufacture, allowRecycler, anchored, anchorable, fittableNonSingleton, 1 AS published, 0 AS dataID FROM invGroups";
	if(sDatabase.RunQuery(res, q)==false)
	{
		_log(SERVICE__ERROR, "Error in query for cached object 'config.BulkData.groups': %s", res.error.c_str());
		return NULL;
	}
	return DBResultToCRowset(res);
}
Beispiel #27
0
PyRep *ObjCacheDB::Generate_eveBulkDataUnits()
{
	DBQueryResult res;
	const char *q = "SELECT unitID, unitName, displayName FROM eveUnits";
	if(sDatabase.RunQuery(res, q)==false)
	{
		_log(SERVICE__ERROR, "Error in query for cached object 'config.BulkData.units': %s", res.error.c_str());
		return NULL;
	}
	return DBResultToCRowset(res);
}
Beispiel #28
0
PyRep *ObjCacheDB::Generate_mapCelestialDescriptions()
{
	DBQueryResult res;
	const char *q = "SELECT celestialID, description FROM mapCelestialDescriptions";
	if(sDatabase.RunQuery(res, q)==false)
	{
		_log(SERVICE__ERROR, "Error in query for cached object 'config.BulkData.mapcelestialdescriptions': %s", res.error.c_str());
		return NULL;
	}
	return DBResultToCRowset(res);
}
Beispiel #29
0
PyRep *ObjCacheDB::Generate_invMetaTypes()
{
	DBQueryResult res;
	const char *q = "SELECT typeID, parentTypeID, metaGroupID FROM invMetaTypes";
	if(sDatabase.RunQuery(res, q)==false)
	{
		_log(SERVICE__ERROR, "Error in query for cached object 'config.BulkData.invmetatypes': %s", res.error.c_str());
		return NULL;
	}
	return DBResultToCRowset(res);
}
Beispiel #30
0
PyRep *ObjCacheDB::Generate_ramCompletedStatuses()
{
	DBQueryResult res;
	const char *q = "SELECT completedStatusID, completedStatusName FROM ramCompletedStatuses";
	if(sDatabase.RunQuery(res, q)==false)
	{
		_log(SERVICE__ERROR, "Error in query for cached object 'config.BulkData.ramcompletedstatuses': %s",res.error.c_str());
		return NULL;
	}
	return DBResultToCRowset(res);
}