From 70cba442eacef4b6535b7d14dc0f47cc36162510 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20W=C3=B3jtowicz?= Date: Sat, 2 Sep 2017 23:11:10 +0200 Subject: [PATCH] Minors for linux compatibility; Updated readme --- README.md | 27 +++++++++++++++++++++++++-- qt-sql-example.pro | 2 +- src/mainwindow.cpp | 2 +- src/mainwindow.ui | 33 ++++++++++++++++----------------- 4 files changed, 43 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 92d7233..f0c4c9f 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,32 @@ # Qt SQL Example -An exemplary Qt app that connects to SQL server and displays a table from a database. The program was made for educational purposes. +An exemplary [Qt](https://www.qt.io/) app that connects to SQL server and displays a table from a database. The program was made for educational purposes. ![](screenshot.png) The program was tested on: - * client: Windows 10, Qt 5.9.1, + * clients: Windows 10 with Qt 5.9.1, Ubuntu 16.04 with Qt 5.5.1, * servers: MySQL Server 5.5.57, Microsoft SQL Server 2008 R2 SP3. + +## Client config + +The program reads `config.ini` on startup. The file must be located in the app working directory. + +## SQL database drivers + +A comprehensive discussion about SQL database drivers can be found in [Qt Documentation](https://doc.qt.io/qt-5/sql-driver.html). + +### Windows 10 + +* Both Qt driver plugins should be already bundled with Qt SDK. +* System ODBC driver should be already bundled with Windows. +* System MySQL driver can be *installed* by placing `libmysql.dll` from [C API for MySQL (mysqlclient)](https://dev.mysql.com/downloads/connector/c/) in the app working directory. + +### Ubuntu 16.04 + +Packages with Qt driver plugins and system SQL manager with drivers: + +* MySQL - `libqt5sql5-mysql` `libmysqlclient20`, +* MSSQL/ODBC - `libqt5sql5-odbc` `libodbc1` `odbcinst` `unixodbc` `msodbcsql`__*__. + +__*__ How to install `msodbcsql` - [Installing the Microsoft ODBC Driver for SQL Server on Linux and macOS](https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server). diff --git a/qt-sql-example.pro b/qt-sql-example.pro index cc93e9c..0df86a0 100644 --- a/qt-sql-example.pro +++ b/qt-sql-example.pro @@ -1,4 +1,4 @@ -VERSION = 1.0 +VERSION = 1.1 QMAKE_TARGET_DESCRIPTION = "Qt app that displays SQL table; for educational purposes" QMAKE_TARGET_COPYRIGHT = "Andrzej Wojtowicz, Adam Mickiewicz University in Poznan" QMAKE_TARGET_PRODUCT = "Qt SQL Example" diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 585198d..49161c1 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -63,7 +63,7 @@ MainWindow::MainWindow(QWidget* parent, DbController* dbc, QThread* dbt) : QFileInfo check_file(inifile); if (check_file.exists() && check_file.isFile()) { - QSettings settings(inifile, QSettings::Format::IniFormat); + QSettings settings(inifile, QSettings::IniFormat); QString engine = settings.value("sql/engine", "").toString(); if (engine == "mysql") diff --git a/src/mainwindow.ui b/src/mainwindow.ui index 082b840..b0b7ce2 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -87,7 +87,7 @@ 73 22 - 47 + 65 13 @@ -100,7 +100,7 @@ 163 22 - 47 + 65 13 @@ -172,7 +172,7 @@ 10 24 - 151 + 211 17 @@ -194,7 +194,7 @@ 10 114 - 141 + 211 17 @@ -235,7 +235,7 @@ 30 54 - 51 + 61 16 @@ -256,13 +256,6 @@ password: - lineEdit_login - radio_sql_authentication - radio_windows_authentication - lineEdit_password - label - label_2 - groupBox_sql_drivers @@ -285,7 +278,7 @@ 10 115 - 41 + 81 21 @@ -329,7 +322,7 @@ - database name: + database: @@ -337,7 +330,7 @@ 10 145 - 51 + 81 20 @@ -369,7 +362,7 @@ 10 85 - 41 + 81 21 @@ -387,7 +380,7 @@ - For ODBC/MSSQL: "SQL Server" (Windows), "ODBC Driver 13 for SQL Server", "FreeTDS" (unix), etc. + For ODBC/MSSQL: "SQL Server" (Windows), "ODBC Driver 13 for SQL Server" (unix), etc. @@ -517,6 +510,12 @@ + + + 0 + 0 + + table: