static void Main(string[] args) { var db = new ClickHouseDatabase( new ClickHouseConnectionSettings("Compress=True;CheckCompressedHash=False;Compressor=lz4;Host=192.168.0.163;Port=9000;User=default;Password=;SocketTimeout=600000;Database=TeasersStat;"), new ClickHouseCommandFormatter(), new ClickHouseConnectionFactory(), null, new DefaultPropertyBinder()); /* * db.Open(); * db.BackupDatabase("TeasersStat"); * db.Close(); */ var columns = db.DescribeTable("LastTeasersShows").ToArray(); /* Get data using default binder * db.Open(); * for (int i = 0; i < 10; i++) * { * var res = db.DatabaseExists("test"); * Console.WriteLine($"Database test exists: {res}"); * } * * // Execute query and get result * var queryMappingSuccess = CastRawValuesToClassTypeProperties(db); * db.Close(); */ /* Using custom binder */ /*CustomBinderDemo();*/ }
public static IEnumerable <T> Read <T>(this ClickHouseConnection conn, string commandText) where T : new() { using (ClickHouseDatabase db = conn.CreateDatabase()) { return(db.Read <T>(commandText)); } }
public static IEnumerable <T> Read <T>(this ClickHouseDatabase db, string commandText) where T : new() { ProxyLog.Info(commandText); var entities = db.ExecuteQueryMapping <T>(commandText); ProxyLog.Info($"{entities.Count()} row(s)"); return(entities); }
public AppsController(AppStoreContext context, ClickHouseDatabase clickDB, UserManager <User> userManager, IHostEnvironment env, NotificationsHub notificationsHub) { _context = context; _userManager = userManager; _env = env; _fileHandler = new FileHandler(_env.ContentRootPath, _context); _notificationsHub = notificationsHub; _logsHandler = new LogsHandler(clickDB); }
public ControllerClickhouse() { string dbfile = $"{Environment.CurrentDirectory}\\ruitengdb.db"; mydb = new ClickHouseDatabase( new ClickHouseConnectionSettings(str_connectionn), new ClickHouseCommandFormatter(), new ClickHouseConnectionFactory(), null, new DefaultPropertyBinder()); mydb.Open(); }
public static void CustomBinderDemo() { var db = new ClickHouseDatabase( new ClickHouseConnectionSettings("Compress=True;CheckCompressedHash=False;Compressor=lz4;Host=localhost;Port=9000;User=default;Password=;SocketTimeout=600000;Database=system;"), new ClickHouseCommandFormatter(), new ClickHouseConnectionFactory(), null, new NotImplementedPropertyBinder()); db.Open(); // Execute query and get result var queryMappingSuccess = CastRawValuesToClassTypeProperties(db); db.Close(); }
static void Main(string[] args) { var db = new ClickHouseDatabase( new ClickHouseConnectionSettings("Compress=True;CheckCompressedHash=False;Compressor=lz4;Host=localhost;Port=9000;User=default;Password=;SocketTimeout=600000;Database=default;"), new ClickHouseCommandFormatter(), new ClickHouseConnectionFactory(), null); db.Open(); for (int i = 0; i < 10; i++) { var res = db.DatabaseExists("test"); Console.WriteLine($"Database test exists: {res}"); } db.Close(); }
public LogsHandler(ClickHouseDatabase clickDB) { _clickDB = clickDB; }