Page 2 of 3

Re: Something about SQL

PostPosted: Thu Apr 18, 2013 11:57 am
by Enrico Maria Giordano
André,

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

EMG

Re: Something about SQL

PostPosted: Thu Apr 18, 2013 2:15 pm
by Antonio Linares
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...

Re: Something about SQL

PostPosted: Thu Apr 18, 2013 2:48 pm
by Enrico Maria Giordano
Thank you! But please, set your warnings on! :-)

EMG

Re: Something about SQL

PostPosted: Thu Apr 18, 2013 2:51 pm
by Enrico Maria Giordano
Code: Select all  Expand view
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

Re: Something about SQL

PostPosted: Thu Apr 18, 2013 2:52 pm
by ADutheil
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.

Re: Something about SQL

PostPosted: Thu Apr 18, 2013 3:03 pm
by Enrico Maria Giordano
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

Re: Something about SQL

PostPosted: Thu Apr 18, 2013 3:05 pm
by Enrico Maria Giordano
I try

Code: Select all  Expand view
aWAData[ WA_SYSTEMID ]    := ID_ACCESS


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

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

EMG

Re: Something about SQL

PostPosted: Thu Apr 18, 2013 3:06 pm
by Antonio Linares
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)

Re: Something about SQL

PostPosted: Thu Apr 18, 2013 3:08 pm
by Antonio Linares
Enrico Maria Giordano wrote:I try

Code: Select all  Expand view
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 :-)

Re: Something about SQL

PostPosted: Thu Apr 18, 2013 3:09 pm
by Enrico Maria Giordano
I'm using your tutor01.prg untouched, ID_ACCESS apart.

EMG

Re: Something about SQL

PostPosted: Thu Apr 18, 2013 3:27 pm
by Antonio Linares
Enrico,

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

Re: Something about SQL

PostPosted: Thu Apr 18, 2013 4:54 pm
by Enrico Maria Giordano
I would want to change the engine, just like you do using ADO. :-)

EMG

Re: Something about SQL

PostPosted: Thu Apr 18, 2013 6:01 pm
by Antonio Linares
Enrico,

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

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

Re: Something about SQL

PostPosted: Thu Apr 18, 2013 6:11 pm
by Enrico Maria Giordano
Antonio,

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

Thank you.

EMG

Re: Something about SQL

PostPosted: Thu Apr 18, 2013 6:42 pm
by Antonio Linares
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)