Page 1 of 1

MySql and Fivewin

Posted: Tue Apr 25, 2006 3:40 pm
by jacquet philippe
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 .

Posted: Tue Apr 25, 2006 4:44 pm
by DanielPuente
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:

Code: Select all

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,

Posted: Tue Apr 25, 2006 7:17 pm
by jacquet philippe
Thanks for this answer .
Why not using the fiveodbc ?

Ph Jacquet.

Posted: Tue Apr 25, 2006 7:42 pm
by DanielPuente
jacquet:

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

Regards

Posted: Tue Apr 25, 2006 11:05 pm
by Taiwan
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

Tmysql, mysql.lib

Posted: Wed Apr 26, 2006 5:55 pm
by fsandoval
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