示例#1
0
 public LootDrop(MySqlConnection connection, QueryConfig config)
     : base(config)
 {
     _newQuery = _queries.GetExtensionQuery("NewInsert");
     //_newQuery = _queries.ExtensionQueries.FirstOrDefault(x => x.Name == "NewInsert");
     _connection = connection;
 }
 public SpawnGroupAggregatorDatabase(MySqlConnection connection,QueryConfig config)
     : base(config)
 {
     _connection = connection;
     _getMaxId = Queries.GetExtensionQuery("GetMaxID");
     _getByZone = Queries.GetExtensionQuery("GetByZone");
 }
 public ZoneSpawnsDatabase(MySqlConnection connection, QueryConfig config)
     : base(config)
 {
     _connection = connection;
     _allVersions = Queries.GetExtensionQuery("GetAllVersions");
     _getMaxZoneId = Queries.GetExtensionQuery("GetMaxZoneID");
     _getMaxId = Queries.GetExtensionQuery("GetMaxID");
 }
 public NpcAggregatorDatabase(MySqlConnection connection, QueryConfig config)
     : base(config)
 {
     _connection = connection;
     _lookupByZone = _queries.GetExtensionQuery("LookupByZone");
     _maxIdForZone = _queries.GetExtensionQuery("MaxIdForZone");
     //_lookupByZone = _queries.ExtensionQueries.FirstOrDefault(x => x.Name == "LookupByZone");
     //_maxIdForZone = _queries.ExtensionQueries.FirstOrDefault(x => x.Name == "MaxIdForZone");
 }
 public SpawnGroupDatabase(MySqlConnection connection, QueryConfig config)
     : base(config)
 {
     _connection = connection;
     _getSpawn2 = Queries.GetExtensionQuery("GetSpawn2");
 }
示例#6
0
        public static TypeQueries Create(XElement element)
        {
            if (element.Name != _XMLTagName && element.Name != _XMLTagNameExt) return null;

            TypeQueries tq;
            if (element.Name == XMLTagName) tq = new TypeQueries();
            else
            {
                tq = new TypeQueriesExtension();
                var name = element.Attribute("name");
                if (name != null) (tq as TypeQueriesExtension).Name = name.Value;
            }

            var insert = element.Element(_XMLInsertTag);
            //if (insert == null) throw new Exception( String.Format("Undefined insert query - missing '{0}' tag",_XMLInsertTag) );
            if( insert != null )
            {
                var sql = insert.Element(_XMLSQLTag);
                if (sql == null) throw new Exception(String.Format("Undefined query string - missing '{0}' tag", _XMLSQLTag));
                tq.InsertQuery = sql.Value;

                var list = new List<string>();
                foreach (var param in insert.Elements(_XMLParamTag))
                {
                    //tq._insertParameters.Add(param.Value);
                    list.Add(param.Value);
                }
                tq._insertArgs = list.ToArray();
            }

            var delete = element.Element(_XMLDeleteTag);
            //if (delete == null) throw new Exception(String.Format("Undefined delete query - missing '{0}' tag", _XMLDeleteTag));
            if( delete != null )
            {
                var sql = delete.Element(_XMLSQLTag);
                if (sql == null) throw new Exception(String.Format("Undefined query string - missing '{0}' tag", _XMLSQLTag));
                tq.DeleteQuery = sql.Value;

                var list = new List<string>();
                foreach (var param in delete.Elements(_XMLParamTag))
                {
                    list.Add(param.Value);
                    //tq._deleteParameters.Add(param.Value);
                }

                tq._deleteArgs = list.ToArray();
            }

            var update = element.Element(_XMLUpdateTag);
            //if (update == null) throw new Exception(String.Format("Undefined update query - missing '{0}' tag", _XMLUpdateTag));
            if( update != null )
            {
                var sql = update.Element(_XMLSQLTag);
                if (sql == null) throw new Exception(String.Format("Undefined query string - missing '{0}' tag", _XMLSQLTag));
                tq.UpdateQuery = sql.Value;

                var list = new List<string>();
                foreach (var param in update.Elements(_XMLParamTag))
                {
                    //tq._updateParameters.Add(param.Value);
                    list.Add(param.Value);
                }
                tq._updateArgs = list.ToArray();
            }

            var select = element.Element(_XMLSelectTag);
            if (select != null)
            {
                var sql = select.Element(_XMLSQLTag);
                if (sql == null) throw new Exception(String.Format("Undefined query string - missing '{0}' tag", _XMLSQLTag));
                tq.SelectQuery = sql.Value;

                var list = new List<string>();
                foreach (var param in select.Elements(_XMLParamTag))
                {
                    //tq._selectParameters.Add(param.Value);
                    list.Add(param.Value);
                }
                tq._selectArgs = list.ToArray();

                foreach (var store in select.Elements(_XMLStoreTag))
                {
                    var field = store.Attribute(_XMLStoreFieldAttr);
                    if (field == null) continue;

                    var type = store.Attribute(_XMLStoreTypeAttr);
                    if (type == null) continue;

                    var property = store.Value;
                    if (property == null) continue;

                    SelectQueryFieldStore.DataTypes etype;
                    switch(type.Value)
                    {
                        case "int": etype = SelectQueryFieldStore.DataTypes.Int;
                            break;
                        case "float": etype = SelectQueryFieldStore.DataTypes.Float;
                            break;
                        case "string": etype = SelectQueryFieldStore.DataTypes.String;
                            break;
                        case "bool": etype = SelectQueryFieldStore.DataTypes.Bool;
                            break;
                        case "long": etype = SelectQueryFieldStore.DataTypes.Long;
                            break;
                        case "short": etype = SelectQueryFieldStore.DataTypes.Short;
                            break;
                        default:
                            etype = SelectQueryFieldStore.DataTypes.String;
                            break;
                    }

                    tq._selectQueryFields.Add(new SelectQueryFieldStore(field.Value, property, etype));
                }
            }

            return tq;
        }
示例#7
0
 public Grid(QueryConfig config)
     : base(config)
 {
     _queryByNpcName = _queries.GetExtensionQuery("QueryByNPCName");
     //_queryByNpcName = _queries.ExtensionQueries.FirstOrDefault(x => x.Name == "QueryByNPCName");
 }