FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour HBMK2 Problem linking
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
HBMK2 Problem linking
Posted: Thu Jun 04, 2020 05:05 PM
Hi Guys,

IF I create a rowset where I use ORDER or LIMIT EditSource() Is not working. I think it's doing wrong changes in my sql statement. Please look at this little code:
Code (fw): Select all Collapse
oRs := oBD:QUERY("SELECT * FROM tipos AS tip  ORDER BY ctipo LIMIT 1000")

oRs:bEdit   := { |oRec| ManTab( oRec,"M") }

oBrw:EditSource( .t. )


When oBrw:EditSource( .t. ) is Run, there is happening an error with this message:
04/06/2020 13:45:05: FWMARIACONNECTION:EXECUTE_SQL( 6163 ) cCallStack( "<-", 3 ) = "FWMARIACONNECTION:EXECUTE( 6453 )<-FWMARIAROWSET:RESYNC( 3757 )<-FWMARIAROWSET:ROWGET( 4971 )<-TDATAROW:READOBJ( 943 )<-TDATAROW:LOAD( 251 )<-TDATAROW:NEW( 196 )<-FWMARIAROWSET:DATAROW( 5056 )<-(b)FWMARIAROWSET_SETXBROWSE( 5068 )<-TXBROWSE:DATAROW( 10680 )<-TXBROWSE:EDIT( 10723 )<-(b)TXBROWSE( 753 )<-TXBROWSE:EDITSOURCE( 0 )<-(b)VFAMANARQ( 141 )<-TBUTTONBMP:CLICK( 179 )<-TBUTTON:HANDLEEVENT( 1755 )<-TBUTTONBMP:HANDLEEVENT( 261 )<-_FWH( 3546 )<-SENDMESSAGE( 0 )<-TDIALOG:COMMAND( 425 )<-TWINDOW:HANDLEEVENT( 0 )<-TDIALOG:HANDLEEVENT( 923 )<-DIALOGBOX( 0 )<-TDIALOG:ACTIVATE( 305 )<-VFAMANARQ( 151 )<-CHAMAPRG( 53 )<-(b)FAZMENUMOD( 389 )<-TMENU:ACTIVATE( 1595 )<-(b)DEFBTNBARSIS( 171 )<-TRBTN:CLICK( 717 )<-TRBTN:LBUTTONUP( 893 )<-TCONTROL:HANDLEEVENT( 1791 )<-TRBTN:HANDLEEVENT( 1575 )<-_FWH( 3546 )<-WINRUN( 0 )<-TMDIFRAME:ACTIVATE( 1078 )<-START( 96 )" cSql = "SELECT * FROM tipos as TIP ORDER BY CTIPO LIMIT 1000 WHERE `TIP`.`CTIPO` = '01'" uRet = ::nError = 1064 ::cError = "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE `TIP`.`CTIPO` = '01'' at line 1" ::cSqlInfo = ""


IF I remove clausules ORDER and LIMIT everything is fine. Could you help me ?
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 151
Joined: Wed Oct 12, 2005 01:03 PM
Re: Editsource() Problem
Posted: Fri Jun 05, 2020 02:00 AM

LE QUITARIA LA OPCION "AS TIP"

oRs := oBD:QUERY("SELECT * FROM tipos ORDER BY ctipo LIMIT 1000")

Marco Augusto Rodriguez Manzo

FWH January 2020 Xharbour 1.2.3

MySQL 5.0.19 Fastreport



PERZO SOFT

Sistemas Personalizados
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: Editsource() Problem
Posted: Fri Jun 05, 2020 10:55 AM

Thanks Marcos,
But, as I say before. the problem is happening because I'm using clausules ORDER and LIMIT. IF I remove then everything is fine.

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 151
Joined: Wed Oct 12, 2005 01:03 PM
Re: Editsource() Problem
Posted: Fri Jun 05, 2020 06:25 PM
Efectivamente es un error del programa Editsource()
está mandando el WHERE después del ORDER y LIMIT ,
lo cual es un error de sintaxis para MYSQL

WINRUN( 0 )<-TMDIFRAME:ACTIVATE( 1078 )<-START( 96 )"
cSql = "SELECT * FROM tipos as TIP ORDER BY CTIPO LIMIT 1000 WHERE `TIP`.`CTIPO` = '01'"
Marco Augusto Rodriguez Manzo

FWH January 2020 Xharbour 1.2.3

MySQL 5.0.19 Fastreport



PERZO SOFT

Sistemas Personalizados
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Editsource() Problem
Posted: Sat Jun 06, 2020 11:45 AM
Efectivamente es un error del programa Editsource()
está mandando el WHERE después del ORDER y LIMIT ,
lo cual es un error de sintaxis para MYSQL


Right
Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Editsource() Problem
Posted: Sat Jun 06, 2020 03:44 PM
In this sample, I tested with a similar SQL statement.
I am not getting any problem.
Please try building and running this sample and let us know if you get any errors.

Code (fw): Select all Collapse
#include "fivewin.ch"

function Main()

   local oCn, oRs

   oCn   := FW_DemoDB( 6 )
   if oCn == nil
      ? "connect fail"
      return nil
   endif
   oRs   := oCn:RowSet( "SELECT * FROM states AS st ORDER BY code LIMIT 5" )
   ? oRs:cResyncSQL
   XBROWSER oRs FASTEDIT TITLE FWVERSION

   oRs:Close()
   oCn:Close()

return nil




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



G. N. Rao.

Hyderabad, India
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: Editsource() Problem
Posted: Mon Jun 08, 2020 12:46 PM
Mr Rao,
I'm using HBMK2 to generate the EXE. IF you save the hbp file bellow as test.hbp in your sample directory, and do HBMK2 test.hbp, you will see the problem.
Code (fw): Select all Collapse
#Nome do arquivo gerado
-otestsqla

#Tipo de arquivo gerado (exe)
-hbexe
-mt

#Incremental
-inc

#Includes
-ic:\FWH19\include

#Lib's
-Lc:\FWH19\lib
-lFiveH
-lFiveHC
-lLibMySql

-lhbwin
-lgtgui
-lhbct
-lhbpp
-lxhb
-lhbziparc
-lhbmzip
-lminizip
-lhbtip

-Lc:\Bcc73\lib
-lcw32mt
-luuid 
-limport32
-lws2_32

-Lc:\Bcc73\lib\psdk
-lodbc32
-lnddeapi
-liphlpapi 
-lmsimg32
-lpsapi
-lrasapi32
-lgdiplus
-lshell32


#PRGs
C:\FWH19\SAMPLES\TESTSQLA.PRG

#Identifica que usa UI
-gtgui
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Editsource() Problem
Posted: Mon Jun 08, 2020 12:58 PM

FWH is natively shipped with buildh.bat, buildx.bat, buildh32.bat, etc.
Please build with buildh.bat and let us know if it is working correctly as expected or not.

Regards



G. N. Rao.

Hyderabad, India
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: Editsource() Problem
Posted: Mon Jun 08, 2020 01:00 PM
No, when I use buildh.bat to generate the exe, it's working perfectly.
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Editsource() Problem
Posted: Mon Jun 08, 2020 01:03 PM

That means the problem is not with FWH provided libs and build scripts.

Regards



G. N. Rao.

Hyderabad, India
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: Editsource() Problem
Posted: Mon Jun 08, 2020 01:32 PM

Yes, but with HBMK2 doesn't work, and I guess that should work with HBMK2 too, isn't it ?

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 55
Joined: Tue Jun 30, 2015 02:26 AM
Re: Editsource() Problem
Posted: Mon Jun 08, 2020 02:35 PM

Hello, I'm working with Vilian in this project

As we mentioned before here in the forum, we used to build our applications with buildh, but, since we heard about the benefits of coding with Visual Studio Code and building with hbmk2, we are trying to migrate our projects to it's patterns.

Vilian spotted this issue earlier today, and we already tried to build it with builh.bat (the old way we used to build our applications), it works fine. But we are trying to build it using hbmk2, and now, analysing both building processes, we spotted some differences, specially about the compiling files order and we suspect that this is the real problem.

(Just for the record, we have some overwritten methods from core harbour libraries in some of lib's created by ourselves...)

Using builh.bat is possible to create a script and set the order for our files to be compiled. But hbmk2, eventhough we define an order in our .hbp file, the sequence is completely different because, by default, the core harbour libraries are compiled/linked after all of the files listed in our .hbp file.

I was able to track this difference by comparing the .map file generated by both building processes and by tracing it in .hbp files.

We suspect that this difference between building processes are changing the priority of our overwritten methods. I don't really know if that makes senses, but as we are clueless about this issue, maybe that could be a start point...

Sds,
Ricardo Arraes
ricardo@vfatec.com.br
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Editsource() Problem
Posted: Mon Jun 08, 2020 03:16 PM
I never used hbmk2. I now like to learn from you.
When I execute the above hbp file with \harbour\bin\hbmk2.exe, I am getting this error.
(I changed my FWH and bcc7 paths)

Code (fw): Select all Collapse
C:\FWH\samples>\harbour\bin\hbmk2 test.hbp
hbmk2[test]: Could not detect any supported C compiler in your PATH.
             Setup one or set -comp= option to one of these values: mingw,
             msvc, clang, bcc, watcom, icc, pocc, xcc, tcc, mingw64, msvc64,
             msvcia64, bcc64, iccia64, pocc64


Please advise me how do I deal with this error
Regards



G. N. Rao.

Hyderabad, India
Posts: 55
Joined: Tue Jun 30, 2015 02:26 AM
Re: Editsource() Problem
Posted: Mon Jun 08, 2020 03:27 PM
ok, sure!

I faced this issue when I first tried to compile with hbmk2.

I guess you can add to your command line:

C:\FWH\samples>\harbour\bin\hbmk2 test.hbp -comp bcc

Or you can try this .bat (adjusting the directories):

Code (fw): Select all Collapse
set oldpath=C:\PathExample\
set path=C:\BCC73\bin;
C:\harbour19\bin\hbmk2 test.hbp
set path=%oldpath%


I suppose that the bat is setting your directory so it can find the bcc compiler.

But as you are trying to build a sample, maybe the first option is enough. (But I don't really know how the first option finds the bcc compiler :-) )
Sds,
Ricardo Arraes
ricardo@vfatec.com.br
Posts: 55
Joined: Tue Jun 30, 2015 02:26 AM
Re: Editsource() Problem
Posted: Mon Jun 08, 2020 03:37 PM

By the way...

adding to your test.hbp file (anywhere you like )the parameters :

-map

-trace

you can generate the .map file (which I used previously to track the difference between these bulding processes) and trace the compiling/linking process.

Sds,
Ricardo Arraes
ricardo@vfatec.com.br