public override object Call(CHXRequest data, string method) { var serverName = data.Find("server"); var schemaName = data.Find("schema"); if (serverName == null) { return(null); } var myDatabase = CHXDatabaseFactory.GetDatabase(serverName.Value.ToString()); if (myDatabase == null) { return(null); } var resultData = myDatabase.Database.Indexes.Where(d => d.SchemaName == schemaName.Value.ToString()).Select(d => new { name = d.IndexName, columnname = d.ColumnName, isunique = d.IsUnique, tablename = d.TableName, schemaname = d.SchemaName }); return(resultData); }
public override object Call(CHXRequest data, string method) { var serverName = data.Find("server"); var schemaName = data.Find("schema"); if (serverName == null) { return(null); } var myDatabase = CHXDatabaseFactory.GetDatabase(serverName.Value.ToString()); if (myDatabase == null) { return(null); } var resultData = myDatabase.Database.Sequences.Where(d => d.SchemaName == schemaName.Value.ToString()).Select(d => new { name = d.SequenceName, maximumvalue = d.MaximumValue, minimumvalue = d.MinimumValue, startvalue = d.StartValue, tablename = d.TableName, currentvalue = d.CurrentValue, schemaname = d.SchemaName }); return(resultData); }
public override object Call(CHXRequest data, string method) { var serverName = data.Find("server"); var schemaName = data.Find("schema"); var constraintName = data.Find("constraintname"); var tableName = data.Find("tablename"); if (serverName == null) { return(null); } var myDatabase = CHXDatabaseFactory.GetDatabase(serverName.Value.ToString()); if (myDatabase == null) { return(null); } var resultData = myDatabase.Database.Constraints.Where(d => d.SchemaName == schemaName.Value.ToString() && d.ConstraintName == constraintName.Value.ToString() && d.TableName == tableName.Value.ToString()).Select(d => new { name = d.ConstraintName, tablename = d.TableName, constrainttype = d.ConstraintType, constraintvalue = d.ConstraintValue, schemaname = d.SchemaName, }); return(resultData); }
public override object Call(CHXRequest data, string method) { var serverName = data.Find("server"); var schemaName = data.Find("schema"); var tableName = data.Find("tablename"); if (serverName == null) { return(null); } var myDatabase = CHXDatabaseFactory.GetDatabase(serverName.Value.ToString()); if (myDatabase == null) { return(null); } var resultData = myDatabase.Database.Tables.Where(d => d.SchemaName == schemaName.Value.ToString() && d.TableName == tableName.Value.ToString()).Select(d => new { tablename = d.TableName, geometrycolumn = d.GeometryColumn, ısspatial = d.IsSpatial, ısview = d.IsView, schemaname = d.SchemaName, ownername = d.OwnerName, constraints = d.Constraints.Select(c => new { name = c.ConstraintName, constrainttype = c.ConstraintType }).ToList(), depens = d.DependsTableList.Select(dep => new { tablename = dep.TableName }).ToList(), sequences = d.Sequences.Select(s => new { columnname = s.ColumnName, currentvalue = s.CurrentValue, maximumvalue = s.MaximumValue, minimumvalue = s.MinimumValue, name = s.SequenceName, startvalue = s.StartValue, schemaname = s.SchemaName }).ToList(), columns = d.Columns.Select(c => new { name = c.ColumnName, DataType = c.DataType, DefaultValue = c.DefaultValue, IsNullable = c.IsNullable, MaximumLength = c.MaximumLength }).ToList() }).FirstOrDefault(); return(resultData); }
public override object Call(CHXRequest data, string method) { if (method.ToLower() != "post") { return(null); } var _name = data.Find("name"); var _model = data.Find("model"); var _server = data.Find("server"); var _schema = data.Find("schema"); var _query = data.Find("query"); if (_server == null) { return(null); } if (_query == null) { return(null); } var result = CHXDataModelManager.Query((data.ConvertData.model.ToString() as string), _server.Value.ToString(), CHXQueryType.Json); if (result is CHXFeatures) { var model = new CHXModel() { Name = _name.Value.ToString(), QueryString = data.ConvertData.model.ToString() }; CHXDataModelManager.ModelCollection.Add(model); } else { throw new Exception("Query doğru çalışmadı"); } var collection = new CHXFeatureCollection(); collection.features = result as CHXFeatures; collection.type = "FeatureCollection"; return("OK"); }
public override object Call(CHXRequest data, string method) { if (method.ToLower() != "post") { return(null); } var _server = data.Find("server"); var _schema = data.Find("schema"); var _query = data.Find("query"); if (_server == null) { return(null); } if (_query == null) { return(null); } var result = CHXDataModelManager.Query(data.Data, _server.Value.ToString(), CHXQueryType.Json); //var mydb = CHXDatabaseFactory.GetDatabase(_server.Value.ToString()); //if (mydb == null) throw new NullReferenceException($"{_server.Value.ToString()} isimli veri tabanı bulunamadı"); //var query = mydb.Database.ConvertQuery<string>(data.Data, CHXQueryType.Json); //var result = mydb.Database.RunQuery<dynamic>(query); if (result == null) { return(null); } var collection = new CHXFeatureCollection(); collection.features = result as CHXFeatures; collection.type = "FeatureCollection"; return(collection); }
public override object Call(CHXRequest data, string method) { if (method.ToLower() != "put") { return(null); } var _name = data.Find("name"); var _type = data.Find("type"); var _parameters = data.Find("parameters"); if (_name == null) { return(null); } if (_type == null) { return(null); } if (_parameters == null) { return(null); } if (CHXDatabaseFactory.DatabaseCollection[_name.Value.ToString()] != null) { return("Aynı isimden veri tabanı bulunuyor"); } CHXDatabaseType databaseType = (CHXDatabaseType)System.Enum.Parse(typeof(CHXDatabaseType), _type.Value.ToString()); var parameters = new CHXDatabaseParameters(); parameters.AddRange(_parameters.Select(p => new CHXDatabaseParameter(p.Name, p.Value.ToString()))); CHXDatabaseFactory.AddDatabase(_name.Value.ToString(), parameters, databaseType); return(_name.Value.ToString()); }
public override object Call(CHXRequest data, string method) { var serverName = data.Find("server"); var myDatabase = CHXDatabaseFactory.GetDatabase(serverName.Value.ToString()); if (myDatabase == null) { return(null); } return(myDatabase.Database.Version); }
public override object Call(CHXRequest data, string method) { if (method.ToLower() != "post") { return(null); } var _name = data.Find("name"); CHXDatabaseFactory.DeleteDatabase(_name.Value.ToString()); return("OK"); }
public override object Call(CHXRequest data, string method) { if (method.ToLower() != "post") { return(null); } var _name = data.Find("name"); if (_name == null) { return(null); } CHXDataModelManager.ModelCollection.Remove(_name.Value.ToString()); return("OK"); }