FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour How to use TMysql (xHarbour)?
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
How to use TMysql (xHarbour)?
Posted: Wed May 13, 2009 08: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 2304 / 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)
Posts: 1076
Joined: Fri Oct 07, 2005 10:41 PM
Re: How to use TMysql (xHarbour)?
Posted: Wed May 13, 2009 08:28 PM

dutch,

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

is spanish.

William, Morales

Saludos



méxico.sureste
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re: How to use TMysql (xHarbour)?
Posted: Thu May 14, 2009 07: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.

Code (fw): Select all Collapse
#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 2304 / 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)
Posts: 1076
Joined: Fri Oct 07, 2005 10:41 PM
Re: How to use TMysql (xHarbour)?
Posted: Thu May 14, 2009 06:05 PM

dutch,

Dutch,

The DLL should be in the folder where the EXE.

William, Morales

Saludos



méxico.sureste
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re: How to use TMysql (xHarbour)?
Posted: Thu May 14, 2009 06: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 2304 / 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)
Posts: 1076
Joined: Fri Oct 07, 2005 10:41 PM
Re: How to use TMysql (xHarbour)?
Posted: 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
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re: How to use TMysql (xHarbour)?
Posted: Fri May 15, 2009 04:56 AM

Dear William,

I cannot read Spanish.

Regards,
Dutch

Regards,

Dutch



FWH 2304 / 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)
Posts: 1076
Joined: Fri Oct 07, 2005 10:41 PM
Re: How to use TMysql (xHarbour)?
Posted: Fri May 15, 2009 06: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
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re: How to use TMysql (xHarbour)?
Posted: Fri May 22, 2009 04: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 2304 / 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)
Posts: 1076
Joined: Fri Oct 07, 2005 10:41 PM
Re: How to use TMysql (xHarbour)?
Posted: Fri May 22, 2009 06: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
Posts: 2170
Joined: Fri Jul 18, 2008 01:24 AM
Re: How to use TMysql (xHarbour)?
Posted: Thu Jun 04, 2009 07: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
Posts: 1076
Joined: Fri Oct 07, 2005 10:41 PM
Re: How to use TMysql (xHarbour)?
Posted: Thu Jun 04, 2009 07:21 AM

FranciscoA,

Contestado en el foro en español....

William, Morales

Saludos



méxico.sureste

Continue the discussion