コード例 #1
0
        public PyDataType GetMultiInvTypesEx(PyList <PyInteger> ids)
        {
            MySqlConnection connection = null;
            MySqlDataReader reader     = Database.PrepareQuery(ref connection,
                                                               $"SELECT typeID, groupID, typeName, description, graphicID, radius, mass, volume, capacity, portionSize, raceID, basePrice, published, marketGroupID, chanceOfDuplicating, dataID FROM invTypes WHERE typeID IN ({PyString.Join(',', ids)})"
                                                               ).ExecuteReader();

            using (connection)
                using (reader)
                {
                    return(RowList.FromMySqlDataReader(Database, reader));
                }
        }
コード例 #2
0
        public PyDataType GetMultiInvTypesEx(PyList ids)
        {
            string query = "SELECT typeID, groupID, typeName, description, graphicID, radius, mass, volume, capacity, portionSize, raceID, basePrice, published, marketGroupID, chanceOfDuplicating, dataID FROM invTypes WHERE typeID IN (";
            Dictionary <string, object> parameters = new Dictionary <string, object>();

            foreach (PyDataType id in ids)
            {
                parameters["@typeID" + parameters.Count.ToString("X")] = (int)(id as PyInteger);
            }

            // prepare the correct list of arguments
            query += String.Join(',', parameters.Keys) + ")";

            MySqlConnection connection = null;
            MySqlDataReader reader     = Database.PrepareQuery(ref connection, query, parameters);

            using (connection)
                using (reader)
                {
                    return(RowList.FromMySqlDataReader(reader));
                }
        }