PDA

View Full Version : MySQL plugin



ksqt
10th April 2006, 16:51
Has anyone successfully built the mysql plugin for the Windows open source version using MinGW?

fullmetalcoder
10th April 2006, 17:32
yep!:cool:
What's your problem? Did you try passing related parameters to configure.exe?

ksqt
10th April 2006, 17:51
yep!:cool:
What's your problem? Did you try passing related parameters to configure.exe?

I followed these directions:
##########
The configure script cannot detect the neccessary libraries and include files if they are not in the standard paths, so it may be necessary to specify these paths using the -I and -L command-line options. For example, if your MySQL include files are installed in /usr/local/mysql (or in C:\mysql\include on Windows), then pass the following parameter to configure: -I/usr/local/mysql (or -I C:\mysql\include for Windows).
On Windows the -I parameter doesn't accept spaces in filenames, so use the 8.3 name instead; for example, use C:\progra~1\mysql instead of C:\Program Files\mysql.
Use the -qt-sql-<driver> parameter to build the database driver statically into your Qt library or -plugin-sql-<driver> to build the driver as a plugin. Look at the sections that follow for additional information about required libraries.
#############
and also tried these:
#############
You need to get the MySQL installation files. Run SETUP.EXE and choose "Custom Install". Install the "Libs & Include Files" Module. Build the plugin as follows (here it is assumed that MySQL is installed in C:\MYSQL):
cd %QTDIR%\src\plugins\sqldrivers\mysql
qmake -o Makefile "INCLUDEPATH+=C:\MYSQL\INCLUDE" "LIBS+=C:\MYSQL\LIB\OPT\LIBMYSQL.LIB" mysql.pro
nmake
If you are not using a Microsoft compiler, replace nmake with make in the line above.
#############
I have mysql installed to "C:\mysql", and chose to install headers and libraries during the install....

What am I missing?

fullmetalcoder
10th April 2006, 17:53
I followed these directions:
##########
The configure script cannot detect the neccessary libraries and include files if they are not in the standard paths, so it may be necessary to specify these paths using the -I and -L command-line options. For example, if your MySQL include files are installed in /usr/local/mysql (or in C:\mysql\include on Windows), then pass the following parameter to configure: -I/usr/local/mysql (or -I C:\mysql\include for Windows).
On Windows the -I parameter doesn't accept spaces in filenames, so use the 8.3 name instead; for example, use C:\progra~1\mysql instead of C:\Program Files\mysql.
Use the -qt-sql-<driver> parameter to build the database driver statically into your Qt library or -plugin-sql-<driver> to build the driver as a plugin. Look at the sections that follow for additional information about required libraries.
#############
and also tried these:
#############
You need to get the MySQL installation files. Run SETUP.EXE and choose "Custom Install". Install the "Libs & Include Files" Module. Build the plugin as follows (here it is assumed that MySQL is installed in C:\MYSQL):
cd %QTDIR%\src\plugins\sqldrivers\mysql
qmake -o Makefile "INCLUDEPATH+=C:\MYSQL\INCLUDE" "LIBS+=C:\MYSQL\LIB\OPT\LIBMYSQL.LIB" mysql.pro
nmake
If you are not using a Microsoft compiler, replace nmake with make in the line above.
#############
I have mysql installed to "C:\mysql", and chose to install headers and libraries during the install....

What am I missing?

-I"c:\Program Files\..." should work AFAIK
I'm using mingw32 and everything is fine. Dunno how to solve your case....

ksqt
10th April 2006, 18:01
What verion of MySQL are you using?
What is the path?
Are you using MinGW with open source version?
Can you tell me exactly your commands to build Qt with the mysql plugin?

Thanks...:)

L.Marvell
10th April 2006, 18:45
Has anyone successfully built the mysql plugin for the Windows open source version using MinGW?
If you have no mingw-utils installed - install it. Then in %MYSQLDIR%\lib\opt do reimp libmysql.lib. Then go to %QTDIR%\src\plugins\sqldrivers\mysql and do

qmake -o Makefile "INCLUDEPATH+=C:\MYSQL\INCLUDE" "LIBS+=C:\MYSQL\LIB\OPT\liblibmysql.a" mysql.pro

Note for double lib! reimp creates such file.
Then make.
Then be happy :)

ksqt
10th April 2006, 19:00
mingw-utils <---- where do I get this, and where to check if I already have?

ksqt
11th April 2006, 02:58
If you have no mingw-utils installed - install it. Then in %MYSQLDIR%\lib\opt do reimp libmysql.lib. Then go to %QTDIR%\src\plugins\sqldrivers\mysql and do

Note for double lib! reimp creates such file.
Then make.
Then be happy :)

Cool, thanks...!
I now have a qsqlmysql.dll in \plugins\sqldrivers

Why the directions do not point out your instructions, as they do not work as written?

L.Marvell
11th April 2006, 12:22
Why the directions do not point out your instructions, as they do not work as written?
In some cases TT instructions work properly in some no. Maybe it depends on MySQL version, I don't really know.

L.Marvell
11th April 2006, 12:57
In some cases TT instructions work properly in some no. Maybe it depends on MySQL version, I don't really know.
Oops. Mistake. TTs method works good under Linux but not under Windows.

ksqt
11th April 2006, 15:21
Now that mysql is working, here is what I wanted to do....

A mysql database table will be populated with Bulgarian words(cyrillic) and English words via web browser, using in a form:

<form action="<?php echo $_SERVER[PHP_SELF] ?>" method="post" accept-charset="utf-8">

I can then read the cyrillic words in a web browser, but in my qt app, the cyrillic words come out garbled(strange characters).

Can anyone point me in the direction needed to be able to render the cyrillic characters?

Edit.....
Patching ".....\src\sql\drivers\mysql\qsql_mysql.cpp"
in this function


static QTextCodec* codec(MYSQL* mysql)
{
#if MYSQL_VERSION_ID >= 32321
QTextCodec* heuristicCodec = QTextCodec::codecForName(mysql_character_set_name( mysql));
if (heuristicCodec)
return heuristicCodec;
#endif
return QTextCodec::codecForLocale();
}

to this


static QTextCodec* codec(MYSQL* mysql)
{
return QTextCodec::codecForName("UTF-8");
}

and again following directions given by "L.Marvell" accomplished my goal....:)

Thanks to a "Fanda" from the qt-interest mail group list for pointing me to this function.

armandorodriguezlopez
1st August 2007, 19:01
Help!!!!!!!
I try, try and try and i can't create the plugin for mysql, help me please

C:\PROGRA~1>cd mysql

C:\PROGRA~1\MySQL>cd mysqls~1.0

C:\PROGRA~1\MySQL\MYSQLS~1.0>cd lib\opt

C:\PROGRA~1\MySQL\MYSQLS~1.0\lib\opt>reimp libmysql.lib

C:\PROGRA~1\MySQL\MYSQLS~1.0\lib\opt>cd \qt

C:\Qt>cd 4.3.0

C:\Qt\4.3.0>cd src

C:\Qt\4.3.0\src>cd plugins

C:\Qt\4.3.0\src\plugins>cd sqldrivers

C:\Qt\4.3.0\src\plugins\sqldrivers>cd mysql

C:\Qt\4.3.0\src\plugins\sqldrivers\mysql>qmake
^C
C:\Qt\4.3.0\src\plugins\sqldrivers\mysql> qmake -o Makefile "INCLUDEPATH+=C:\PRO
GRA~1\MYSQL\MYSQLS~1.0\INCLUDE" "LIBS+=C:\PROGRA~1\MYSQL\MYSQLS~1.0\LIB\OPT\libl
ibmysql.a" mysql.pro

C:\Qt\4.3.0\src\plugins\sqldrivers\mysql>make
mingw32-make -f Makefile.Release
Makefile.Release:116: *** multiple target patterns. Stop.
mingw32-make[1]: Entering directory `C:/Qt/4.3.0/src/plugins/sqldrivers/mysql'
mingw32-make[1]: Leaving directory `C:/Qt/4.3.0/src/plugins/sqldrivers/mysql'
mingw32-make: *** [release] Error 2

C:\Qt\4.3.0\src\plugins\sqldrivers\mysql>

addu
24th September 2009, 14:26
Hi Marvell

I am trying to create a plugin for Mysql

I did ,what u have mentioned in above replies

My sql path is
c:/Mysql/mysql-noinstall-5.1.38-win32/mysql-5.1.38-win32/lib/opt

here i executed reimp libmysql.lib in Mingw at above path

but it is showing


sh: reimp: command not found


Please help me


Thanks

Yuvaraj R