Questions tagged [qtsql]

Questions related to QtSQl Module, a collection of Qt classes that work with various relational database management systems.

Provides a driver layer, SQL API layer, and a user interface layer for SQL databases.

238 questions
2
votes
3 answers

Got stuck on using prepare() and bindvalue() in c++ Qt

I've written a SQL query based on Qt assistant and it says that you can use the prepare() method instead of exec() then you can pass your parameter by the help of two methods called : bindvalue() and addbindvalue() Here is an snippet code of my…
Vahid Hashemi
  • 5,182
  • 10
  • 58
  • 88
2
votes
1 answer

C++ best mode to code database metadata info

i'm a novice C++ developer. I would like to develop a simple Library in C++ with Qt to handle the configuration for application using for example SQLite Database, simulating a KEY, VALUE access. Actually I use SQLite3 with following…
balucio
  • 124
  • 3
  • 6
2
votes
1 answer

"Error: no matching function or call" to my windows destructor

error: no matching function or call to 'MainWindow::~MainWindow()' Cannot run an app - QtSql. I couldn't find in google way to solve this problem. I have included code from my project files - mainwindow.cpp, main.cpp and mainwindow.h. And I have…
2
votes
1 answer

QtSql create mysql database

Is there a way to connect to the database server without specifying a database? I would like to be able to create a database if it's missing - but the QtSql drivers require some database to connect to.
qdot
  • 6,195
  • 5
  • 44
  • 95
2
votes
1 answer

QT SDK MySQL nmake error

I'm trying to build the QMYSQL plugin for the QT SDK and upon executing qmake (ran successfully) -using the MySQL win32 files I had placed into C:- I tried to run nmake and got the following errors: rc is not recognized as an internal or external…
bremmS
  • 277
  • 1
  • 6
  • 13
1
vote
1 answer

read QTableview selected row QSQLITE database

I show the data of a table (table1) in a QTableView. When the user selects a row, I want to read the data from this highlighted line. How can I do it easily? For example will this read the whole data? query.exec("SELECT * table1);
Martin R
  • 71
  • 9
1
vote
1 answer

Fetch Oracle output of dbms_output.put_line with QtSql

Is it possible to fetch raw DB output of an Oracle DB within a QSqlQuery, e.g. by something like this: QSqlQuery sqlQuery; sqlQuery.prepare("exec dmbs_output.put_line('hello world');"); sqlQuery.exec(); Now I would like to access the output ('hello…
fawick
  • 590
  • 5
  • 20
1
vote
1 answer

qtsql: Query inserts malformed UTF-8 text to MySQL

I want to connect to my MySQL database and insert some UTF8 strings. But when I do the insert query, some text like سسسسسسسسسسسسسسسس is inserted into my table. This is my code: s = QtCore.QString("insert into test4 values('' , '…
1
vote
0 answers

the server version of this postgresql is unknown falling back to the client version

I am currently using postgresql 14.7 and QT5.8.0. When i enter the command "postgres -V" or "psql -V" it both shows 14.7. Hence when i try to use VS2015 and run my code. It managed to establish connection to the database but in the console it keeps…
1
vote
0 answers

Is there a good reason not to use the QtSql library (over, for example, Psycopg) when designing a Qt PostgreSQL database application?

I am writing a GUI database application using Python, the PySide6 Qt bindings, and a PostgreSQL server. It will display database entries and allow the user to add and edit entries. I am quite familiar and comfortable with Psycopg, having used it a…
enduser
  • 21
  • 3
1
vote
0 answers

Does QSqlQuery release automatically?

Does QSqlQuery release automatically? Qt Version:5.12 DataBase:SQLite If a QSqlquery object goes out of scope, is it automatically released? Should I use clear() or finish() to release instead? If I wanna use an QSqlquery many times, shoule I use…
NoobOfCpp
  • 23
  • 2
1
vote
1 answer

Problem with QIBASE (firebird + Ubuntu)

Good morning. I've tried to compile QIBASE driver to access FireBird database using sqlbrowser from %QTDIR/demos. But after i filled all fields in sqlbrowser and pushed OK button the program crashed with…
typbl4
  • 141
  • 8
1
vote
1 answer

Unable to connect to sql server with odbc on QT ubuntu

I'm trying to connect to locahost sql server but all the time I receive error: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Loggin faield for user 'user'. QODBC3: Unable to connect; I'm using Qt 5.4 on ubuntu. Connection string: QString…
imil4eg
  • 77
  • 7
1
vote
2 answers

How can i collect all the Data from a Database by using SqlQuery at once?

I would like to collect all entries in a database and write them into a .csv-file. To do so, i tried to come up with a while-loop like this: def create_csv(): query = QSqlQuery(db=db) query.prepare("SELECT * FROM database_name") …
Nullschall
  • 11
  • 6
1
vote
0 answers

Loading Qt SQL driver plugin from shared library

I have a shared library written in C++/Qt that uses SQLite database. So I need to load qsqlite driver plugin. I want to do it inside of library, but I have an error: QSqlDatabase: an instance of QCoreApplication is required for loading driver…