MySql and Fivewin

MySql and Fivewin

Postby jacquet philippe » Tue Apr 25, 2006 3: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 .
jacquet philippe
 
Posts: 22
Joined: Fri Nov 04, 2005 9:05 pm
Location: LIEGE Belgium

Postby DanielPuente » Tue Apr 25, 2006 4: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:
Code: Select all  Expand view
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
DanielPuente
 
Posts: 108
Joined: Sun Oct 09, 2005 6:12 pm
Location: Mar del Plata - Argentina

Postby jacquet philippe » Tue Apr 25, 2006 7:17 pm

Thanks for this answer .
Why not using the fiveodbc ?

Ph Jacquet.
jacquet philippe
 
Posts: 22
Joined: Fri Nov 04, 2005 9:05 pm
Location: LIEGE Belgium

Postby DanielPuente » Tue Apr 25, 2006 7: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
DanielPuente
 
Posts: 108
Joined: Sun Oct 09, 2005 6:12 pm
Location: Mar del Plata - Argentina

Postby Taiwan » 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
User avatar
Taiwan
 
Posts: 218
Joined: Fri Oct 07, 2005 1:55 am
Location: Taipei, Taiwan

Tmysql, mysql.lib

Postby fsandoval » Wed Apr 26, 2006 5: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
fsandoval
 
Posts: 71
Joined: Mon Oct 10, 2005 9:24 pm
Location: aguascalientes


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Rick Lipkin and 93 guests