How to use TMysql (xHarbour)?

How to use TMysql (xHarbour)?

Postby dutch » Wed May 13, 2009 8:32 am

Dear All,

How can I use TMySql of xHarbour? I try TMySql.prg but it require function in MySql.C. Then I try to compile MySql.C to TMySql.lib but it is not successful. I try to read all post in the forum regarding to this topic but not success.

How do I start to use it?
Which files I need and example for append/modify/delete?

Regards,
Dutch
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1535
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: How to use TMysql (xHarbour)?

Postby wmormar » Wed May 13, 2009 8:28 pm

dutch,

read this blog: http://wmormar.blogspot.com

is spanish.
William, Morales
Saludos

méxico.sureste
User avatar
wmormar
 
Posts: 1074
Joined: Fri Oct 07, 2005 10:41 pm
Location: México

Re: How to use TMysql (xHarbour)?

Postby dutch » Thu May 14, 2009 7:05 am

Dear William,

You Blog is quite good document for starting. I can create 2 library (mysql.lib, libmysql.lib). When I start program, it show connect to MySql but it show error libmysql.dll as following picture. I think the problem is libmysql.dll because I try from many place (fivewin forum, MySql\bin) but not success.
where do I get the right libmysql.dll.
Image
Code: Select all  Expand view
#include "fivewin.ch"
#include "mysql.ch"

static oCon

function Main()
oCon := TMySQLServer():new( "localhost", "root", "nimda", 3306 )

IF oCon:lError
   msginfo("Connection failed, check ..." )
ELSE  
   msginfo("Connected ..." )
   IF oCon:DBExist( "hotel" )
      Browse()
   ENDIF
   IF oCon:lError
      msginfo("The database was not created, check ..." )
   ELSE
      oCon:SelectDB("hotel")
   ENDIF
ENDIF

oCon:end()
RETURN NIL


T
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1535
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: How to use TMysql (xHarbour)?

Postby wmormar » Thu May 14, 2009 6:05 pm

dutch,

Dutch,

The DLL should be in the folder where the EXE.
William, Morales
Saludos

méxico.sureste
User avatar
wmormar
 
Posts: 1074
Joined: Fri Oct 07, 2005 10:41 pm
Location: México

Re: How to use TMysql (xHarbour)?

Postby dutch » Thu May 14, 2009 6:24 pm

Dear William,

Yes, I copy dll to the same folder. It look ok but it error when call method like :selectdb().
Is it the correct one (libmysql.dll from MySql 5.1.34)?

Regards,
Dutch
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1535
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: How to use TMysql (xHarbour)?

Postby wmormar » Fri May 15, 2009 12:35 am

dutch,

si lees un poquillo de español, bien podríamos tener una charla en messenger y con gusto te ayudo.

mi cuenta de messenger es: wmormar@hotmail.com

saludos
William, Morales
Saludos

méxico.sureste
User avatar
wmormar
 
Posts: 1074
Joined: Fri Oct 07, 2005 10:41 pm
Location: México

Re: How to use TMysql (xHarbour)?

Postby dutch » Fri May 15, 2009 4:56 am

Dear William,

I cannot read Spanish.

Regards,
Dutch
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1535
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: How to use TMysql (xHarbour)?

Postby wmormar » Fri May 15, 2009 6:11 am

dutch,

i sorry, we see how help you.

you add my email for msn in you contacts.

regards
William, Morales
Saludos

méxico.sureste
User avatar
wmormar
 
Posts: 1074
Joined: Fri Oct 07, 2005 10:41 pm
Location: México

Re: How to use TMysql (xHarbour)?

Postby dutch » Fri May 22, 2009 4:12 pm

Dear William,

I can link TMySql with xHarbour now. The problem is my batch file.
The Correct link position
=================
echo %hdirl%\mysql.lib + >> b32.bc
echo %hdirl%\libmysql.lib + >> b32.bc
echo %fwh%\lib\Fivehx.lib %fwh%\lib\FiveHC.lib + >> b32.bc

The Bad Link position
=================
echo %fwh%\lib\Fivehx.lib %fwh%\lib\FiveHC.lib + >> b32.bc
echo %hdirl%\mysql.lib + >> b32.bc
echo %hdirl%\libmysql.lib + >> b32.bc

After I change to correct position, I can build the program to connect MySql Server now.

Regards,
Dutch
Regards,
Dutch

FWH 19.01 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio
FWPPC 10.02 / Harbour for PPC (FTDN)
ADS V.9 / MySql / MariaDB
R&R 12 Infinity / Crystal Report XI R2
(Thailand)
User avatar
dutch
 
Posts: 1535
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: How to use TMysql (xHarbour)?

Postby wmormar » Fri May 22, 2009 6:38 pm

dutch,

Me alegra que ya hayas conectado con tmysql.

Cual duda estamos pendientes y es con todo gusto

saludos
William, Morales
Saludos

méxico.sureste
User avatar
wmormar
 
Posts: 1074
Joined: Fri Oct 07, 2005 10:41 pm
Location: México

Re: How to use TMysql (xHarbour)?

Postby FranciscoA » Thu Jun 04, 2009 7:11 am

Dear Dutch:
I'm trying to start using MySql, and I'm very confused about the code below. I have two days without getting work it.
Can this code work only with MySql + xHarbour?, or other component I need?. Can you help?

I reviewed the class tmysql I have, and I do not see anywhere, the command :Execute (), but compiled without errors.
The problem is that it creates not the table, and the table do not exists, and the conection to the server is working well.

function MakeTable( oCon )
local cCmdSql := "CREATE TABLE IF NOT EXISTS TEST ("+;
"ROW_ID INTEGER NOT NULL AUTO_INCREMENT COMMENT 'LLAVE',"+;
"CODIGO CHAR(5) NOT NULL COMMENT 'CODIGO CLIENTE',"+;
"NOMBRE CHAR(30) NOT NULL COMMENT 'NOMBRE CLIENTE',"+;
"ACTIVO BIT NOT NULL COMMENT 'ACTIVO',"+;
"PRIMARY KEY(ROW_ID))"+;
"ENGINE = InnoDB COMMENT 'Test';"

oCon:Execute( cCmdSql )

cCmdSql := "INSERT INTO TEST (CODIGO,NOMBRE,ACTIVO) VALUES('001','NOMBRE01',0);"
oCon:Execute( cCmdSql )
cCmdSql := "INSERT INTO TEST (CODIGO,NOMBRE,ACTIVO) VALUES('002','NOMBRE02',1);"
oCon:Execute( cCmdSql )
cCmdSql := "INSERT INTO TEST (CODIGO,NOMBRE,ACTIVO) VALUES('003','NOMBRE03',0);"
oCon:Execute( cCmdSql )
cCmdSql := "INSERT INTO TEST (CODIGO,NOMBRE,ACTIVO) VALUES('004','NOMBRE04',1);"
oCon:Execute( cCmdSql )
return nil

Regards,
Francisco.
Francisco J. Alegría P.
Chinandega, Nicaragua.

Fwxh-MySql-TMySql
User avatar
FranciscoA
 
Posts: 2147
Joined: Fri Jul 18, 2008 1:24 am
Location: Chinandega, Nicaragua, C.A.

Re: How to use TMysql (xHarbour)?

Postby wmormar » Thu Jun 04, 2009 7:21 am

FranciscoA,

Contestado en el foro en español....
William, Morales
Saludos

méxico.sureste
User avatar
wmormar
 
Posts: 1074
Joined: Fri Oct 07, 2005 10:41 pm
Location: México


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 19 guests