FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Dolphin to FW MySql/Maria upgrade (Solved) ...
Posts: 53
Joined: Wed Aug 06, 2008 05:27 PM
Dolphin to FW MySql/Maria upgrade (Solved) ...
Posted: Mon Jun 15, 2020 02:31 PM
Hello,
I am finishing upgrade from tDolphin to FW MySql/Maria and have one question. Is it some methods to replace this tDolphin code to FW MySql/Maria?

Code (fw): Select all Collapse
oQry := oServer:Query( "CHECK TABLE customer" )
? oQry:lastrec(), oQry:msg_type, oQry:msg_text
oQry:end()


This code code produce error:
Error description: Error BASE/1004 Class: 'NIL' has no exported method: LASTREC
Boris (FWH 20.07, xHarbour 1.2.3, Harbour 3.2.0, BCC74, MySql 5.7)
Posts: 1789
Joined: Tue Oct 11, 2005 05:01 PM
Re: Dolphin to FW MySql/Maria upgrade ...
Posted: Mon Jun 15, 2020 04:18 PM
both harbor and xharbour allow the modification of methods and datas of a class.

examples:
Code (fw): Select all Collapse
/*-------------------------------------------------------------------------------------------------*/

#include "hbclass.ch"

/*-------------------------------------------------------------------------------------------------*/

PROCEDURE OverrideAndExtend()

   EXTEND CLASS TCONTROL WITH METHOD MyDisable
...
...
   OVERRIDE METHOD GETDLGCODE IN CLASS TBUTTON     WITH KGETDLGCODE

RETURN
/*-------------------------------------------------------------------------------------------------*/

FUNCTION MyDisable( aCtrlType )
   LOCAL Self := hb_QSelf()

   IF ( ::ClassName() IN aCtrlType )
      ::bWhen := NIL
      ::Disable()
   ENDIF

RETURN NIL
/*-------------------------------------------------------------------------------------------------*/

FUNCTION KGetDlgCode( nLastKey )
   LOCAL Self := hb_QSelf()

   ::oWnd:nLastKey := nLastKey

   DO CASE
   CASE !hb_isNil( ::oWnd:oWnd ) .and. ( ::oWnd:oWnd:IsKindOf( "TFOLDER" ) .or. ::oWnd:oWnd:IsKindOf( "TFOLDEREX" ) )
      RETURN DLGC_WANTALLKEYS
   CASE nLastKey == VK_ESCAPE .and. !hb_isNil( ::oWnd:oWnd ) .and. ( ::oWnd:oWnd:IsKindOf( "TWINDOW"   ) .and. ::oWnd:IsKindOf( "TDIALOG" ) )
      RETURN DLGC_WANTALLKEYS
   ENDCASE

RETURN NIL


for example for add the method lastrec

Code (fw): Select all Collapse
...
  EXTEND CLASS FWMARIACONNECTION WITH METHOD lastrec
...
FUNCTION Lastrec()
   LOCAL Self := hb_QSelf()
RETURN ::RecCount
..


This is an example, I don't remember the name of the native class for mariadb or mysql handling in fivewin.

note:
reviewing the info of fivewin I see that lastrec exists, so I see in the error the variable oQry has a value of nil, so it means that the query failed

oQry := oServer:Query( "CHECK TABLE customer" )
if !hb_nil(oQry)
? oQry:lastrec(), oQry:msg_type, oQry:msg_text
oQry:end()
else
?"Error in query."
endif


You can verify the name of the table, remember that if your server is linux, it is most likely that the names of tables and fields are case sensitive.
Salu2

Carlos Vargas

Desde Managua, Nicaragua (CA)
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Dolphin to FW MySql/Maria upgrade ...
Posted: Mon Jun 15, 2020 05:37 PM
bosibila wrote:Hello,
I am finishing upgrade from tDolphin to FW MySql/Maria and have one question. Is it some methods to replace this tDolphin code to FW MySql/Maria?

Code (fw): Select all Collapse
oQry := oServer:Query( "CHECK TABLE customer" )
? oQry:lastrec(), oQry:msg_type, oQry:msg_text
oQry:end()


This code code produce error:
Error description: Error BASE/1004 Class: 'NIL' has no exported method: LASTREC


Your query should work, but it fails and that is a bug in our library in respect of SQL statements starting with "CHECK "
We will fix this in this version.
Till then we request you to use this workaround.

Code (fw): Select all Collapse
aResult := oCn:Execute( "CHECK TABLE customer" )  // returns array of the same rows as in a query result
XBROWSER aResult


Thanks for pointing out.
We appreciate for bringing out any other issues that you may come across while migrating.

Notes:
METHODS Query() and RowSet() are synonimous.
Same sql statement when executed with oCn:Execute() returns results as an array.

Please also indicate the version of FWH you are using.
Regards



G. N. Rao.

Hyderabad, India
Posts: 53
Joined: Wed Aug 06, 2008 05:27 PM
Re: Dolphin to FW MySql/Maria upgrade (Solved)...
Posted: Mon Jun 15, 2020 05:48 PM

Thanks mr. Rao,
your solution is acceptable to me. Tested, works OK ...

Boris (FWH 20.07, xHarbour 1.2.3, Harbour 3.2.0, BCC74, MySql 5.7)
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Dolphin to FW MySql/Maria upgrade (Solved)...
Posted: Tue Jun 16, 2020 12:37 AM
bosibila wrote:Thanks mr. Rao,
your solution is acceptable to me. Tested, works OK ...


Please let me know the version of FWH you are using.
Regards



G. N. Rao.

Hyderabad, India
Posts: 53
Joined: Wed Aug 06, 2008 05:27 PM
Re: Dolphin to FW MySql/Maria upgrade (Solved) ...
Posted: Tue Jun 16, 2020 07:04 PM

My version is 20.04 ...

Boris (FWH 20.07, xHarbour 1.2.3, Harbour 3.2.0, BCC74, MySql 5.7)
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Dolphin to FW MySql/Maria upgrade (Solved) ...
Posted: Tue Jun 16, 2020 07:48 PM

This issue is fixed in version FWH 2006.
If you send an email to nageswaragunupudi [at] gmail [dot] com, we can provide the revised libraries (borland 32bit) so that you need not change your source code for this reason alone.

Regards



G. N. Rao.

Hyderabad, India

Continue the discussion