Page 1 of 4

HBMK2 Problem linking

Posted: Thu Jun 04, 2020 5:05 pm
by vilian
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: Select all

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 ?

Re: Editsource() Problem

Posted: Fri Jun 05, 2020 2:00 am
by Marco Augusto
LE QUITARIA LA OPCION "AS TIP"


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

Re: Editsource() Problem

Posted: Fri Jun 05, 2020 10:55 am
by vilian
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.

Re: Editsource() Problem

Posted: Fri Jun 05, 2020 6:25 pm
by Marco Augusto
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'"

Re: Editsource() Problem

Posted: Sat Jun 06, 2020 11:45 am
by nageswaragunupudi
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

Re: Editsource() Problem

Posted: Sat Jun 06, 2020 3:44 pm
by nageswaragunupudi
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: Select all

#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
 
Image

Please also indicate the version of FWH you are using.

Re: Editsource() Problem

Posted: Mon Jun 08, 2020 12:46 pm
by vilian
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: Select all

#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

Re: Editsource() Problem

Posted: Mon Jun 08, 2020 12:58 pm
by nageswaragunupudi
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.

Re: Editsource() Problem

Posted: Mon Jun 08, 2020 1:00 pm
by vilian
No, when I use buildh.bat to generate the exe, it's working perfectly.

Re: Editsource() Problem

Posted: Mon Jun 08, 2020 1:03 pm
by nageswaragunupudi
That means the problem is not with FWH provided libs and build scripts.

Re: Editsource() Problem

Posted: Mon Jun 08, 2020 1:32 pm
by vilian
Yes, but with HBMK2 doesn't work, and I guess that should work with HBMK2 too, isn't it ?

Re: Editsource() Problem

Posted: Mon Jun 08, 2020 2:35 pm
by ricbarraes
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...

Re: Editsource() Problem

Posted: Mon Jun 08, 2020 3:16 pm
by nageswaragunupudi
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: Select all

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

Re: Editsource() Problem

Posted: Mon Jun 08, 2020 3:27 pm
by ricbarraes
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: Select all

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 :mrgreen: )

Re: Editsource() Problem

Posted: Mon Jun 08, 2020 3:37 pm
by ricbarraes
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.