From f3c30df929e0f7a7bba1b918c2552d42ee38c895 Mon Sep 17 00:00:00 2001 From: yury deshin Date: Sun, 7 Jan 2018 16:01:53 -0800 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=20=D0=BC=D0=B5=D1=82=D0=BE=D0=B4=20Open=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20=D0=B2=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6=D0=BD=D0=BE?= =?UTF-8?q?=D1=81=D1=82=D0=B8=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D1=8B=20?= =?UTF-8?q?=D1=81=20ConnectionString=20=D0=B4=D0=BB=D1=8F=20SQLite?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- oscript-sql/DBConnector.cs | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/oscript-sql/DBConnector.cs b/oscript-sql/DBConnector.cs index a45a7d1..e17605b 100644 --- a/oscript-sql/DBConnector.cs +++ b/oscript-sql/DBConnector.cs @@ -228,27 +228,12 @@ public bool Open() { if (DbType == (new EnumDBType()).sqlite) { - string filePath = DbName; - if (filePath == string.Empty ) - { - filePath = ConnectionString; - } - else - { - ConnectionString = filePath; - } - _connection = new SQLiteConnection(string.Format("Data Source={0};", filePath)); - if (System.IO.File.Exists(DbName)) - { - return OpenConnection(); - - } - else - { - Console.WriteLine("Create db: " + DbName); - _connection.Open(); - return true; - } + if (ConnectionString == string.Empty && DbName != string.Empty) + ConnectionString = string.Format("Data Source={0};", DbName); + + _connection = new SQLiteConnection(ConnectionString); + + return OpenConnection(); } else if (DbType == (new EnumDBType()).MSSQLServer) {