PDA

View Full Version : qpsql driver Qt 5.0.1 postgresql 9.2.3



avpro
22nd May 2013, 19:15
hello,

I'm Newbie and i would like to create the QPSQL driver for Windows. I'm running a Win xp sp3 system and I would like to connect from Qt 5.0.1 to postgresql 9.2.3.

Here (http://qt-project.org/doc/qt-4.8/sql-driver.html#qpsql) are the database drivers described, but I think this is not actual for Qt 5.0.1, because I can't find the following dir "src/...":

cd $QTDIR/src/plugins/sqldrivers/psql - i don't have this src folder in my structure.

are you aware of some other, more actual instructions I could follow to create this driver?

thanks for your input.

KaptainKarl
22nd May 2013, 19:45
The sources for the sqldrivers is now under the Src/qtbase subdirectory.
Win32 example: C:\Qt\5.0.1\Src\qtbase
POSIX example: /Qt/5.0.1/Src/qtbase

Karl

avpro
22nd May 2013, 21:49
hi Karl,

thanks for your feedback. i have the following structure:

9055

the SRC folder is missing.

any idea?

KaptainKarl
22nd May 2013, 22:00
Did you install from sources or binaries?
If you installed from the binary installer, then you needed to tell the installer to install the source packages. It does not do this by default.
If you installed from sources, then the sqldrivers folder is in the source tree.

Karl

avpro
1st June 2013, 11:30
Did you install from sources or binaries?
If you installed from the binary installer, then you needed to tell the installer to install the source packages. It does not do this by default.
If you installed from sources, then the sqldrivers folder is in the source tree.

Karl

I've reinstalled QT with sources. I found the files and i started the process of creating the qpsql driver from QT command line.
i used these instructions [qt-project.org] (http://qt-project.org/doc/qt-4.8/sql-driver.html#qpsql)to bild my qpsql driver. everything went fine until here:

cd QTDIR\src\plugins\sqldrivers\psql qmake “INCLUDEPATH+=C:\psql\include” “LIBS+=C:\psql\lib\ms\libpq.lib” psql.pro

after this I’m supposed to lunch the nmake command. unfortunately, nmake is not working.
i received this error: “nmake is not recognized as an internal or external command operable program or batch file”

1. any idea why i receive this error?
2. any idea if the qpsql driver is complete?
3. any idea how could i test the qpsql driver?

thanks for your input.

KaptainKarl
3rd June 2013, 13:00
1. You must execute the vcvarsall.bat file within the shell where you intend to build the plugin in order to set up the environment for visual studio. By default, the batch file is located in C:\Program Files\Microsoft Visual Studio 10.0\VC.

2. It is not complete if it did not compile.

3. Build the Sql Browser example from the Qt examples. Verify the QPSQL driver is in the driver list. Execute a query against an existing database.

OR

Create a Qt Console app with the following code:


qDebug() << QSqlDatabase::drivers();
QSqlDatabase db( QSqlDatabase::addDatabase( "QPSQL" ) );
qDebug() << db.lastError();

Karl

avpro
8th June 2013, 20:24
i'm back,

i reinstalled postgresql in C:\psql
i run qmake command
i run mingw32-make and this error was the output:

C:\Qt\Qt5.0.2\5.0.2\Src\qtbase\src\plugins\sqldriv ers\psql>mingw32-make debug
mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory 'C:/Qt/Qt5.0.2/5.0.2/Src/qtbase/src/plugins/
sqldrivers/psql'
g++ -c -pipe -fno-keep-inline-dllexport -g -std=c++0x -fno-exceptions -frtti -Wa
ll -Wextra -DUNICODE -DQT_NO_CAST_TO_ASCII -DQT_NO_CAST_FROM_ASCII -DQT_NO_EXCEP
TIONS -DQT_PLUGIN -DQT_SQL_LIB -DQT_CORE_LIB -I. -I"C:\psql\include" -I"C:\Qt\Qt
5.0.2\5.0.2\mingw47_32\include" -I"C:\Qt\Qt5.0.2\5.0.2\mingw47_32\include\QtSql"
-I"C:\Qt\Qt5.0.2\5.0.2\mingw47_32\include\QtSql\5.0.2" -I"C:\Qt\Qt5.0.2\5.0.2\m
ingw47_32\include\QtSql\5.0.2\QtSql" -I"C:\Qt\Qt5.0.2\5.0.2\mingw47_32\include\Q
tCore" -I".moc\debug_shared" -I"..\..\..\..\mkspecs\win32-g++" -o .obj\debug_sha
red\qsql_psql.o ..\..\..\sql\drivers\psql\qsql_psql.cpp
In file included from c:\qt\qt5.0.2\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/
4.7.2/include/c++/i686-w64-mingw32/bits/gthr-default.h:41:0,
from c:\qt\qt5.0.2\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/
4.7.2/include/c++/i686-w64-mingw32/bits/gthr.h:150,
from c:\qt\qt5.0.2\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/
4.7.2/include/c++/ext/atomicity.h:34,
from c:\qt\qt5.0.2\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/
4.7.2/include/c++/bits/basic_string.h:41,
from c:\qt\qt5.0.2\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/
4.7.2/include/c++/string:54,
from c:\qt\qt5.0.2\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/
4.7.2/include/c++/random:41,
from c:\qt\qt5.0.2\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/
4.7.2/include/c++/bits/stl_algo.h:67,
from c:\qt\qt5.0.2\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/
4.7.2/include/c++/algorithm:63,
from C:\Qt\Qt5.0.2\5.0.2\mingw47_32\include/QtCore/qglobal.h:80
,
from C:\Qt\Qt5.0.2\5.0.2\mingw47_32\include/QtCore/qatomic.h:42
,
from C:\Qt\Qt5.0.2\5.0.2\mingw47_32\include/QtCore/qvariant.h:4
5,
from C:\Qt\Qt5.0.2\5.0.2\mingw47_32\include/QtSql/qsqlresult.h:
45,
from ..\..\..\sql\drivers\psql\qsql_psql.h:45,
from ..\..\..\sql\drivers\psql\qsql_psql.cpp:42:
C:\psql\include/pthread.h:307:8: error: redefinition of 'struct timespec'
In file included from c:\qt\qt5.0.2\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/
4.7.2/../../../../i686-w64-mingw32/include/time.h:277:0,
from C:\psql\include/pthread.h:218,
from c:\qt\qt5.0.2\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/
4.7.2/include/c++/i686-w64-mingw32/bits/gthr-default.h:41,
from c:\qt\qt5.0.2\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/
4.7.2/include/c++/i686-w64-mingw32/bits/gthr.h:150,
from c:\qt\qt5.0.2\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/
4.7.2/include/c++/ext/atomicity.h:34,
from c:\qt\qt5.0.2\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/
4.7.2/include/c++/bits/basic_string.h:41,
from c:\qt\qt5.0.2\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/
4.7.2/include/c++/string:54,
from c:\qt\qt5.0.2\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/
4.7.2/include/c++/random:41,
from c:\qt\qt5.0.2\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/
4.7.2/include/c++/bits/stl_algo.h:67,
from c:\qt\qt5.0.2\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/
4.7.2/include/c++/algorithm:63,
from C:\Qt\Qt5.0.2\5.0.2\mingw47_32\include/QtCore/qglobal.h:80
,
from C:\Qt\Qt5.0.2\5.0.2\mingw47_32\include/QtCore/qatomic.h:42
,
from C:\Qt\Qt5.0.2\5.0.2\mingw47_32\include/QtCore/qvariant.h:4
5,
from C:\Qt\Qt5.0.2\5.0.2\mingw47_32\include/QtSql/qsqlresult.h:
45,
from ..\..\..\sql\drivers\psql\qsql_psql.h:45,
from ..\..\..\sql\drivers\psql\qsql_psql.cpp:42:
c:\qt\qt5.0.2\tools\mingw\bin\../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686
-w64-mingw32/include/sys/timeb.h:90:8: error: previous definition of 'struct tim
espec'
Makefile.Debug:486: recipe for target '.obj/debug_shared/qsql_psql.o' failed
mingw32-make[1]: *** [.obj/debug_shared/qsql_psql.o] Error 1
mingw32-make[1]: Leaving directory 'C:/Qt/Qt5.0.2/5.0.2/Src/qtbase/src/plugins/s
qldrivers/psql'
makefile:48: recipe for target 'debug' failed
mingw32-make: *** [debug] Error 2

C:\Qt\Qt5.0.2\5.0.2\Src\qtbase\src\plugins\sqldriv ers\psql>


any idea what is wrong? why i can't build the qpsql driver?
thanks for your input