FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Something about SQL
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Something about SQL
Posted: Thu Apr 18, 2013 11:57 AM

André,

can you explain, step by step, how to use Mediator? :-)

EMG

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Something about SQL
Posted: Thu Apr 18, 2013 02:15 PM
Enrico,

I just tested an uploaded a first test for SQLWIN. It will provide you a clear idea about the translations that SQLWIN does :-)
To build it simply do: FWH\samples\buildh.bat tutor01

The entire SQLWIN code is included in this tutor0.prg so there is no need to build a library, link a library, etc. to test SQLWIN :-)

https://code.google.com/p/sqlwin/downloads/detail?name=tutor01.prg

SQLWIN is a translator, that takes the DBFs syntax and convert it into SQL sentences. Basically you connect to a DataBase engine and start issuing SQL sentences.

The advantage over ADO (we also created ADORDD) is that ADO is not needed at all. You can directly connect to a DataBase client DLL and avoid any intermediate layer, so it could work on any operating system (no ADO required) :-)

The real advantage of SQLWIN is that we don't need to modify our existing applications source code. The idea is to replace the RDD and the RDD logic will do the "miracle" to use SQL :-)

Warning: SQLWIN is a work in progress. If any of you want to have it ready soon, then cooperate in its development and tests :-)

SQLRDD, Mediator, etc. do basically the same, with the difference that they are closed (you don't have the source code for the RDD), so if you get a bug there is nothing you can do, except report it and wait...
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Something about SQL
Posted: Thu Apr 18, 2013 02:48 PM

Thank you! But please, set your warnings on! :-)

EMG

Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Something about SQL
Posted: Thu Apr 18, 2013 02:51 PM
Code (fw): Select all Collapse
tutor01.prg(22) Warning W0002  Overloaded #define HB_SYMBOL_UNUSED
tutor01.prg(72) Warning W0001  Ambiguous reference: 'CRLF'
tutor01.prg(163) Warning W0033  Variable 'ARDATA' is never assigned in function 'SQL_INIT(157)'
tutor01.prg(292) Warning W0032  Variable 'CTABLENAME' is assigned but not used in function 'SQL_CREATE(188)'
tutor01.prg(292) Warning W0032  Variable 'CSERVER' is assigned but not used in function 'SQL_CREATE(190)'
tutor01.prg(292) Warning W0032  Variable 'CUSERNAME' is assigned but not used in function 'SQL_CREATE(191)'
tutor01.prg(292) Warning W0032  Variable 'CPASSWORD' is assigned but not used in function 'SQL_CREATE(192)'
tutor01.prg(292) Warning W0032  Variable 'CSQL' is assigned but not used in function 'SQL_CREATE(253)'
tutor01.prg(292) Warning W0032  Variable 'CSQL' is assigned but not used in function 'SQL_CREATE(265)'
tutor01.prg(292) Warning W0032  Variable 'CSQL' is assigned but not used in function 'SQL_CREATE(277)'
tutor01.prg(396) Warning W0003  Variable: 'CSCHEMA' declared but not used in function: 'SQL_CREATEFIELDS(296)'
tutor01.prg(396) Warning W0003  Variable: 'CSEQUENCEFIELD' declared but not used in function: 'SQL_CREATEFIELDS(296)'
tutor01.prg(494) Warning W0003  Variable: 'OERROR' declared but not used in function: 'SQL_OPEN(399)'
tutor01.prg(494) Warning W0003  Variable: 'ORECORDSET' declared but not used in function: 'SQL_OPEN(400)'
tutor01.prg(511) Warning W0032  Variable 'AWADATA' is assigned but not used in function 'SQL_CLOSE(496)'
tutor01.prg(654) Warning W0032  Variable 'CSQL' is assigned but not used in function 'SQL_GOBOTTOM(637)'
tutor01.prg(654) Warning W0032  Variable 'CSQL' is assigned but not used in function 'SQL_GOBOTTOM(641)'
tutor01.prg(684) Warning W0003  Variable: 'NRECORDS' declared but not used in function: 'SQL_SKIPRAW(654)'
tutor01.prg(684) Warning W0032  Variable 'AWADATA' is assigned but not used in function 'SQL_SKIPRAW(656)'
tutor01.prg(701) Warning W0032  Variable 'AWADATA' is assigned but not used in function 'SQL_EOF(694)'
tutor01.prg(719) Warning W0003  Variable: 'LDELETED' declared but not used in function: 'SQL_DELETED(701)'
tutor01.prg(719) Warning W0032  Variable 'AWADATA' is assigned but not used in function 'SQL_DELETED(703)'
tutor01.prg(728) Warning W0032  Variable 'AWADATA' is assigned but not used in function 'SQL_DELETE(721)'
tutor01.prg(814) Warning W0032  Variable 'CRDDSEP' is assigned but not used in function 'SQL_PUTVALUE(780)'
tutor01.prg(814) Warning W0032  Variable 'LAPP' is assigned but not used in function 'SQL_PUTVALUE(781)'
tutor01.prg(814) Warning W0032  Variable 'CSQL' is assigned but not used in function 'SQL_PUTVALUE(782)'
tutor01.prg(882) Warning W0032  Variable 'AWADATA' is assigned but not used in function 'SQL_ORDINFO(869)'
tutor01.prg(905) Warning W0032  Variable 'AWADATA' is assigned but not used in function 'SQL_RAWLOCK(898)'
tutor01.prg(915) Warning W0032  Variable 'AWADATA' is assigned but not used in function 'SQL_LOCK(907)'
tutor01.prg(923) Warning W0032  Variable 'AWADATA' is assigned but not used in function 'SQL_UNLOCK(917)'
tutor01.prg(930) Warning W0003  Variable: 'AFILTERINFO' declared but not used in function: 'SQL_SETFILTER(923)'
tutor01.prg(930) Warning W0032  Variable 'AWADATA' is assigned but not used in function 'SQL_SETFILTER(925)'
tutor01.prg(936) Warning W0032  Variable 'AWADATA' is assigned but not used in function 'SQL_CLEARFILTER(932)'
tutor01.prg(983) Warning W0003  Variable: 'LCONTINUE' declared but not used in function: 'SQL_LOCATE(972)'
tutor01.prg(983) Warning W0032  Variable 'AWADATA' is assigned but not used in function 'SQL_LOCATE(974)'
tutor01.prg(1042) Warning W0032  Variable 'AWADATA' is assigned but not used in function 'SQL_SETREL(1026)'
tutor01.prg(1042) Warning W0032  Variable 'CKEYNAME' is assigned but not used in function 'SQL_SETREL(1029)'
tutor01.prg(1059) Warning W0003  Variable: 'AORDERINFO' declared but not used in function: 'SQL_ORDLSTADD(1042)'
tutor01.prg(1059) Warning W0032  Variable 'AWADATA' is assigned but not used in function 'SQL_ORDLSTADD(1044)'
tutor01.prg(1076) Warning W0032  Variable 'AWADATA' is assigned but not used in function 'SQL_ORDLSTCLEAR(1061)'
tutor01.prg(1119) Warning W0003  Variable: 'AORDERCREATEINFO' declared but not used in function: 'SQL_ORDCREATE(1076)'
tutor01.prg(1119) Warning W0003  Variable: 'OINDEX' declared but not used in function: 'SQL_ORDCREATE(1079)'
tutor01.prg(1119) Warning W0003  Variable: 'OERROR' declared but not used in function: 'SQL_ORDCREATE(1079)'
tutor01.prg(1119) Warning W0003  Variable: 'N' declared but not used in function: 'SQL_ORDCREATE(1079)'
tutor01.prg(1119) Warning W0032  Variable 'AWADATA' is assigned but not used in function 'SQL_ORDCREATE(1078)'
tutor01.prg(1119) Warning W0032  Variable 'LFOUND' is assigned but not used in function 'SQL_ORDCREATE(1079)'
tutor01.prg(1140) Warning W0003  Variable: 'AORDERINFO' declared but not used in function: 'SQL_ORDDESTROY(1119)'
tutor01.prg(1140) Warning W0003  Variable: 'N' declared but not used in function: 'SQL_ORDDESTROY(1121)'
tutor01.prg(1140) Warning W0003  Variable: 'OINDEX' declared but not used in function: 'SQL_ORDDESTROY(1121)'
tutor01.prg(1140) Warning W0032  Variable 'AWADATA' is assigned but not used in function 'SQL_ORDDESTROY(1121)'
tutor01.prg(1191) Warning W0033  Variable 'CSUPERRDD' is never assigned in function 'SQLWIN_GETFUNCTABLE(1142)'
tutor01.prg(1492) Warning W0003  Variable: 'CTABLENAME' declared but not used in function: 'SQL_WRITERECORD(1383)'
tutor01.prg(1492) Warning W0003  Variable: 'TEMP' declared but not used in function: 'SQL_WRITERECORD(1384)'


EMG
Posts: 368
Joined: Sun May 31, 2009 06:25 PM
Re: Something about SQL
Posted: Thu Apr 18, 2013 02:52 PM

I did a few year ago but if I remember well, you have to download and install ODBC and Mediator server. Then you download Mediator client and link to your app. If I remember well there is a tool to upload your DBFs to mysql that creates the needed fields to fake a DBF on SQL (recno, deleted). I droped it because not all client accept to let you install the server part.

Regards,



André Dutheil

FWH 13.04 + HB 3.2 + MSVS 10
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Something about SQL
Posted: Thu Apr 18, 2013 03:03 PM
ADutheil wrote:I did a few year ago but if I remember well, you have to download and install ODBC and Mediator server. Then you download Mediator client and link to your app. If I remember well there is a tool to upload your DBFs to mysql that creates the needed fields to fake a DBF on SQL (recno, deleted). I droped it because not all client accept to let you install the server part.


This is a serious problem... I'll continue to try SQLWIN... :-)

EMG
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Something about SQL
Posted: Thu Apr 18, 2013 03:05 PM
I try

Code (fw): Select all Collapse
aWAData[ WA_SYSTEMID ]    := ID_ACCESS


but I get "Too many recursive error handler calls". :-)

I don't have other engines to try...

EMG
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Something about SQL
Posted: Thu Apr 18, 2013 03:06 PM
Enrico Maria Giordano wrote:Thank you! But please, set your warnings on! :-)

EMG


Enrico,

I know, I know, but this is just prototype ("quick & dirty") code :-)

We can clean it later on... (mainly we used AdoRdd as the starting point and modified it on the run)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Something about SQL
Posted: Thu Apr 18, 2013 03:08 PM
Enrico Maria Giordano wrote:I try

Code (fw): Select all Collapse
aWAData[ WA_SYSTEMID ]    := ID_ACCESS


but I get "Too many recursive error handler calls". :-)

I don't have other engines to try...

EMG


Enrico,

Are you opnening an Access mdb database ? Please post the code that you are testing, thanks :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Something about SQL
Posted: Thu Apr 18, 2013 03:09 PM

I'm using your tutor01.prg untouched, ID_ACCESS apart.

EMG

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Something about SQL
Posted: Thu Apr 18, 2013 03:27 PM

Enrico,

What database engine will be using the app that you plan to port ?

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Something about SQL
Posted: Thu Apr 18, 2013 04:54 PM

I would want to change the engine, just like you do using ADO. :-)

EMG

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Something about SQL
Posted: Thu Apr 18, 2013 06:01 PM

Enrico,

Based on your ADO experience, have you considered to use the ADORDD ?

I think it may better suit to your needs :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Something about SQL
Posted: Thu Apr 18, 2013 06:11 PM

Antonio,

please elaborate the concept. What is the difference between ADORDD and WINSQL? What are the pros and cons of both?

Thank you.

EMG

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Something about SQL
Posted: Thu Apr 18, 2013 06:42 PM

Enrico,

Harbour level || RDD level || executed code

db functions => ADORDD => ADO calls (ADO is required and used)

db functions => SQLWIN => SQL sentences (ADO is not required)

regards, saludos

Antonio Linares
www.fivetechsoft.com