FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour MySql and Fivewin
Posts: 22
Joined: Fri Nov 04, 2005 09:05 PM
MySql and Fivewin
Posted: Tue Apr 25, 2006 03:40 PM

I have to establish a connection
with files locate on a web server running mysql and php.
What have i to do ? .
Where can i find some samples :
connection,browse,insert modify , delete
Thanks a lot .
Ph Jacquet .

Posts: 108
Joined: Sun Oct 09, 2005 06:12 PM
MySql and Fivewin
Posted: Tue Apr 25, 2006 04:44 PM
jacquet:

You have to use mysqls classes or libs, por example Manuel Explosito's eagle1 (not free, 50 euros), or the mysql libs for harbour / xharbour.

You will find information in:

Eagle1:

- http://es.groups.yahoo.com/group/eagle1/
- 80.59.9.216 (news server for outlook express)

And in harbour/xharbour.org contribs.

Sample code for eagle1:
oMySql := TMSConnect():New()
oMySql:Connect( cHost, cUser, cPassword )

	SELE 1
	cTabla:='cores_usuarios'
	oTabla1 := TMsTable():New( oDataBase, cTabla )
        oTabla1:Open()

	SELE 1
  REDEFINE LISTBOX oBCli;
					 FIELDS	TRANSFORM(oTabla1:xFieldGet( 1 ),'99999'), ;
            		  oTabla1:xFieldGet( 2 ), ;
            		  oTabla1:xFieldGet( 3 ), ;
            		  oTabla1:xFieldGet( 4 ), ;
            		  TRANSFORM(oTabla1:xFieldGet( 5 ),'9999'), ;

        ..... etc, etc, as usual

REDEFINE GET oCOD     VAR wCOD       ID 113 OF oDlg PICTURE "@Z 9999" VALID Q_COD( wCOD,"ALT_USU")

        ...... all the controls as usual

       Then, for inserting:

			oSql := TMsQuery():Query( oDatabase, "INSERT INTO cores_usuarios (nomcli,usuario,pass,nro_cliente,nivel_acceso) "+;
			                                     "VALUES ('"+wDes+"','"+wUsuario+"','"+wClave+"','"+PADL(wCod,4,'0')+"','"+PADL(wCodnivel,1,'0')+"')")

if !oSql:Open()
oSql:oError:Say()
endif

oSql:Close()

	 oTabla1:setorder(2)
	 oTabla1:GoTop():Read()
	 oBcli:Setfocus()
	 oBcli:Refresh()
	 oBcli:Upstable()


Regards,
Daniel Puente
Mar del Plata, Argentina
danielpuente@speedy.com.ar
puenteda@hotmail.com
Posts: 22
Joined: Fri Nov 04, 2005 09:05 PM
MySql and Fivewin
Posted: Tue Apr 25, 2006 07:17 PM

Thanks for this answer .
Why not using the fiveodbc ?

Ph Jacquet.

Posts: 108
Joined: Sun Oct 09, 2005 06:12 PM
MySql and Fivewin
Posted: Tue Apr 25, 2006 07:42 PM

jacquet:

         You can use odbc if you want, but if you use the mysql api directly it should go faster.

Regards

Daniel Puente
Mar del Plata, Argentina
danielpuente@speedy.com.ar
puenteda@hotmail.com
Posts: 218
Joined: Fri Oct 07, 2005 01:55 AM
MySql and Fivewin
Posted: Tue Apr 25, 2006 11:05 PM

jacquet,

I use DrMySQL library to connect mysql server.

Sample code below:

METHOD ReBrowse() CLASS TA_Acc_Cust

::oMainDb:Query( "select * from a_cust_code order by name1 limit 100" )

REDEFINE BROWSE ::oBrw ID 301 OF ::oDlg

  ::oBrw:SetODBF( ::oMainDb )
  ::oBrw:bKeyDown   := {| nKey | ::BrwKeyDown ( nKey ) }
  ::oBrw:bChange    := {|| ::DisplayData() }
  ::oBrw:lCellStyle := .t.
  BrwGrade( ::oBrw )

  ADD TO ::oBrw DATA ::oMainDb:CODE ;
      TITLE "CODE"                  ;
      SIZE 49

METHOD ReGet() CLASS TA_Acc_Cust

REDEFINE GET ::oMainDb:oNAME VAR ::oMainDb:NAME ID 101 OF ::oDlg
REDEFINE GET ::oMainDb:oCODE VAR ::oMainDb:CODE ID 102 OF ::oDlg

METHOD IsSave() CLASS TA_Acc_Cust

IF ::lNew
::oMainDb:Insert()
ELSE
::oMainDb:Update()
ENDIF

Regards,

Richard
Fivetech.net Taiwan

richard.service@seed.net.tw

Posts: 71
Joined: Mon Oct 10, 2005 09:24 PM
Tmysql, mysql.lib
Posted: Wed Apr 26, 2006 05:55 PM

jac, I use mysql of contrib, with some change made, why mysql.lib is more speed of ado and odbc, and more important you can made change of your need.

regards.
fernando sandoval

fernando sandoval ruiz
fsandoval@hotmail.com

Continue the discussion