1
0

Minors for linux compatibility;

Updated readme
This commit is contained in:
Andrzej Wójtowicz 2017-09-02 23:11:10 +02:00
parent 1c15c1b020
commit 70cba442ea
4 changed files with 43 additions and 21 deletions

View File

@ -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).

View File

@ -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"

View File

@ -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")

View File

@ -87,7 +87,7 @@
<rect>
<x>73</x>
<y>22</y>
<width>47</width>
<width>65</width>
<height>13</height>
</rect>
</property>
@ -100,7 +100,7 @@
<rect>
<x>163</x>
<y>22</y>
<width>47</width>
<width>65</width>
<height>13</height>
</rect>
</property>
@ -172,7 +172,7 @@
<rect>
<x>10</x>
<y>24</y>
<width>151</width>
<width>211</width>
<height>17</height>
</rect>
</property>
@ -194,7 +194,7 @@
<rect>
<x>10</x>
<y>114</y>
<width>141</width>
<width>211</width>
<height>17</height>
</rect>
</property>
@ -235,7 +235,7 @@
<rect>
<x>30</x>
<y>54</y>
<width>51</width>
<width>61</width>
<height>16</height>
</rect>
</property>
@ -256,13 +256,6 @@
<string>password:</string>
</property>
</widget>
<zorder>lineEdit_login</zorder>
<zorder>radio_sql_authentication</zorder>
<zorder>radio_windows_authentication</zorder>
<zorder>lineEdit_password</zorder>
<zorder>label</zorder>
<zorder>label_2</zorder>
<zorder>groupBox_sql_drivers</zorder>
</widget>
<widget class="QPushButton" name="button_connect">
<property name="geometry">
@ -285,7 +278,7 @@
<rect>
<x>10</x>
<y>115</y>
<width>41</width>
<width>81</width>
<height>21</height>
</rect>
</property>
@ -329,7 +322,7 @@
</rect>
</property>
<property name="text">
<string>database name:</string>
<string>database:</string>
</property>
</widget>
<widget class="QLabel" name="label_6">
@ -337,7 +330,7 @@
<rect>
<x>10</x>
<y>145</y>
<width>51</width>
<width>81</width>
<height>20</height>
</rect>
</property>
@ -369,7 +362,7 @@
<rect>
<x>10</x>
<y>85</y>
<width>41</width>
<width>81</width>
<height>21</height>
</rect>
</property>
@ -387,7 +380,7 @@
</rect>
</property>
<property name="toolTip">
<string>For ODBC/MSSQL: &quot;SQL Server&quot; (Windows), &quot;ODBC Driver 13 for SQL Server&quot;, &quot;FreeTDS&quot; (unix), etc.</string>
<string>For ODBC/MSSQL: &quot;SQL Server&quot; (Windows), &quot;ODBC Driver 13 for SQL Server&quot; (unix), etc.</string>
</property>
<property name="text">
<string/>
@ -517,6 +510,12 @@
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_5">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>table:</string>
</property>