예제 #1
0
        private void CloseDb()
        {
            _connectionClient?.Close();
            _connectionClient?.Dispose();

            _connectionServer?.Close();
            _connectionServer?.Dispose();
        }
예제 #2
0
        private static void Main(string[] args)
        {
            var path   = Directory.GetCurrentDirectory();
            var source = Path.Combine(path, "sample.db");

            Console.WriteLine($"Db: {source}");

            var connection = new SQLiteServerConnection($"Data Source={source};Version=3;", Address, Port, Backlog, HeartBeatTimeOut);

            try
            {
                connection.Open();

                Console.CursorVisible = true;
                Console.WriteLine("Press Exit to ... exit (duh)");
                while (true)
                {
                    var s = Console.ReadLine();
                    if (s == null)
                    {
                        continue;
                    }
                    if (s.ToLower() == "exit")
                    {
                        Console.WriteLine("Ok, bye");
                        break;
                    }

                    TryExecute(s, connection);
                }

                connection.Close();
            }
            catch (Exception e)
            {
                Console.WriteLine($"Unable to open '{source}', please check your permissions.");
                Console.WriteLine($"Error was : {e.Message}.");
            }
        }