// // Summary: // Returns a System.Data.DataTable that describes the column metadata of the System.Data.SqlClient.SqlDataReader. // // Returns: // A System.Data.DataTable that describes the column metadata. // // Exceptions: // T:System.InvalidOperationException: // The System.Data.SqlClient.SqlDataReader is closed. /*public override DataTable GetSchemaTable() * { * var dt = new DataTable(); * dt.Columns.Add("ColumnName"); * dt.Columns.Add("ColumnOrdinal"); * dt.Columns.Add("ColumnType"); * * var i = 0; * foreach (var col in m_cols) * { * var row = dt.NewRow(); * row["ColumnName"] = col["name"].ToString(); * row["ColumnType"] = col["columnType"].ToString(); * row["ColumnOrdinal"] = i; * i += 1; * } * * return dt; * }*/ private Type getType(string typeName, string columnName) { Type type; switch (typeName.ToLower()) { case "integer": case "int2": case "int4": case "smallint": type = typeof(int); break; case "biginteger": case "serial": case "bigserial": type = typeof(Int64); break; case "decimal": case "numeric": case "float8": case "float4": case "real": type = typeof(double); break; case "timestamp": case "timestamptz": case "date": case "time": type = typeof(DateTime); break; case "character": case "char": case "varchar": case "text": case "character varying": type = typeof(string); break; case "bytea": type = typeof(byte[]); break; default: throw new ArgumentException("The data type for column " + columnName + " of data source " + m_dataSource.getName() + " is not supported"); } return(type); }
private void registerDataSource(JObject request) { var dataSources = request["message"]["data"]["data"]; foreach (var dataSource in dataSources) { cJSONDataSource ds = new cJSONDataSource(dataSource["name"].ToString(), dataSource["data"] as JObject); cJSONServer.registerDataSource(ds, m_database + "." + ds.getName()); } }