ADO RDD xHarbour

Re: ADO RDD xHarbour

Postby byte-one » Sun Oct 18, 2015 9:04 am

Antonio, there are still warnings on compiling! You should use es2 as errorlevel in compiler.

Compiling 'C:\adordd\adordd.prg'...
C:\adordd\adordd.prg(486) Warning W0001 Ambiguous reference: 'OCATALOG'
C:\adordd\adordd.prg(487) Warning W0001 Ambiguous reference: 'OCATALOG'
C:\adordd\adordd.prg(1906) Warning W0001 Ambiguous reference: 'XVALUE'
C:\adordd\adordd.prg(1922) Warning W0001 Ambiguous reference: 'XVALUE'
C:\adordd\adordd.prg(5722) Warning W0001 Redefinition or duplicate definition of #define DBS_NAME
C:\adordd\adordd.prg(5723) Warning W0001 Redefinition or duplicate definition of #define DBS_TYPE
C:\adordd\adordd.prg(5724) Warning W0001 Redefinition or duplicate definition of #define DBS_LEN
C:\adordd\adordd.prg(5725) Warning W0001 Redefinition or duplicate definition of #define DBS_DEC
C:\adordd\adordd.prg(5757) Warning W0005 RETURN statement with no return value in function

Also this function is missing: waiton( " Subdir......"+ cFile)
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Re: ADO RDD xHarbour

Postby AHF » Sun Oct 18, 2015 10:11 am

Gunther,

I dont know why didnt get those errors.
Its corrected for next posted version.
Meanwhile please alter in adordd.prg :

C:\adordd\adordd.prg(1906) Warning W0001 Ambiguous reference: 'XVALUE' with cFieldName
C:\adordd\adordd.prg(1922) Warning W0001 Ambiguous reference: 'XVALUE' with uInfo
C:\adordd\adordd.prg(5757) Warning W0005 RETURN statement with no return value in function RETURN NIL

You can delete these:
C:\adordd\adordd.prg(5722) Warning W0001 Redefinition or duplicate definition of #define DBS_NAME
C:\adordd\adordd.prg(5723) Warning W0001 Redefinition or duplicate definition of #define DBS_TYPE
C:\adordd\adordd.prg(5724) Warning W0001 Redefinition or duplicate definition of #define DBS_LEN
C:\adordd\adordd.prg(5725) Warning W0001 Redefinition or duplicate definition of #define DBS_DEC
waiton( " Subdir......"+ cFile)

Thanks
Regards
Antonio H Ferreira
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Re: ADO RDD xHarbour

Postby AHF » Mon Oct 19, 2015 2:16 pm

adordd finished version at https://github.com/AHFERREIRA/adordd.git

adordd is finished!
I don't have plans to add any new functionalities to it.
Its now working just like any other kind dbfcdx rdd and it allows you to port your app in minutes (time to load tables) to any SQL.

From now on Ill only post new versions to correct bugs.

All your comments, experiences, ideas and bug reports are most welcomed!

New features:

1) ADO_EXIT called internally to close all tables and connections whe exit the app.

2) Gave up the idea of persistent recordsets to open huge sets because the difference speed in opening
its completely lost closing it( saving it) instead I ve made a new set.

SET ADO CACHESIZE TO 100 ASYNC ON ASYNCNOWAIT ON
This set has huge impact on performance opening huge tables.
Playing with this set might improve significantly the opening time but then you might not have all rows available immediately.
You have to test yourself if your app works ok with the different options.

adordd main problem is opening huge tables without any where clause causing it to load all rows.
This brings problems with loading time and memory consumption.

On the other hand please remember that this would be the slowest loading time of a table no matter if you have
1 or 200 users opposite to dbfcdx kind of rdds.

This is not a standard practice in SQL but to keep backwards compatibility with our apps we need to do it
like this.

In apps where there aren't any historic files and all data is kept in the working tables the only alternative is either to pass old data to historic files or use USE ctable WHERE where clause.
If you cannot do any of these and you have huge tables adordd might not be for you and in these cases the only alternative to go to SQL is ADS as far as I know (keeping almost same app code ).

The only workaround for this limitation is to build a class accessing the SQL through C interface (HDO from Exposito for ex).
adordd can work with any other class as long as the few methods and data adordd use from MS ADO are
replicated in that class.
This class could build the sets in a local dbf files, arrays etc.
Regards
Antonio H Ferreira
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Re: ADO RDD xHarbour

Postby Kleyber » Mon Oct 19, 2015 7:27 pm

Antonio,

First of all congratulations for this huge job! I'm going to test it ASAP. Just a question: Is there any working example showing all (or most of all) features of your rdd?

TIA,
Kleyber Derick

FWH / xHb / xDevStudio / SQLLIB
User avatar
Kleyber
 
Posts: 581
Joined: Tue Oct 11, 2005 11:28 am
Location: São Luiz, Brasil

Re: ADO RDD xHarbour

Postby AHF » Mon Oct 19, 2015 7:43 pm

Kleyber,

Thanks.

You have tryadordd but be advise that I didnt test it myself with these last versions, but should be a good guide.

There arent any special features to show, it works just like dbcdx kind rdd.
The best way to test it is to upload your tables compile and link adordd and run it.
Please read 01_readme.pdf you have it all there.
Regards
Antonio H Ferreira
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Re: ADO RDD xHarbour

Postby Horizon » Tue Oct 20, 2015 8:22 am

Thank you for your effort Antonio,

I'll try it also as soon as possible.
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1288
Joined: Fri May 23, 2008 1:33 pm

Re: ADO RDD xHarbour

Postby byte-one » Tue Oct 20, 2015 11:07 am

Antonio, this error comes on different places in the code of adordd.prg. I tested with access and mssql.

Error description: Error ADODB.Recordset/6 DISP_E_UNKNOWNNAME: OPEN
Args:
[ 1] = C SELECT `AUTO_INCREMENT` FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA = 'adisc' AND TABLE_NAME = 'TABLE1'
[ 2] = O ADODB.Connection

Stack Calls
===========
Called from: => TOLEAUTO:OPEN( 0 )
Called from: C:\adordd\adordd.prg => ADORECCOUNT( 806 )
Called from: C:\adordd\adordd.prg => ADO_REFRESH( 823 )
Called from: C:\adordd\adordd.prg => ADO_GOTOP( 989 )
Called from: C:\adordd\adordd.prg => ADO_OPEN( 381 )
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Re: ADO RDD xHarbour

Postby AHF » Tue Oct 20, 2015 11:30 am

Gunther,

This routine returns the lastrec().

With access it can not error that because with engine = ACCESS its SELECT MAX--- you can check the code.

As I informed previously I only tried it with Access but mainly with MySql.

I suspect that with MsSql the syntax of SELECT ... FROM SCHEMA... its wrong.

Do you know the correct one ?

Meantime if you want to try it replace in ADORECCOUNT

IF aAWData[ WA_ENGINE ] = "ACCESS" .OR. aAWData[ WA_ENGINE ] = "MSSQL"

Its slower but it should work.
Regards
Antonio H Ferreira
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Re: ADO RDD xHarbour

Postby byte-one » Tue Oct 20, 2015 12:20 pm

Antonio, with Access i read this error:

Error description: Error ADODB.Recordset/6 DISP_E_UNKNOWNNAME: OPEN
Args:
[ 1] = C SELECT * FROM TABLE1 ORDER BY HBRECNO
[ 2] = O ADODB.Connection
[ 3] = N 2
[ 4] = N 3
[ 5] = N 0

Stack Calls
===========
Called from: => TOLEAUTO:OPEN( 0 )
Called from: C:\adordd\adordd.prg => ADO_OPEN( 318 )

In tryadordd.prg:
Code: Select all  Expand view
  SET ADO DEFAULT DATABASE TO "D:\WHATEVER\TESTADORDD.MDB" SERVER TO "ACESS" ENGINE TO ACCESS USER TO "" PASSWORD TO ""
 
should be:
Code: Select all  Expand view
SET ADO DEFAULT DATABASE TO "D:\WHATEVER\TESTADORDD.MDB" SERVER TO "" ENGINE TO "ACCESS" USER TO "" PASSWORD TO ""
 

Code: Select all  Expand view
MSGINFO("DOES TABLE1 EXISTS ON DB ?"+CVALTOCHAR(hb_adoRddExistsTable( "Table1") ))
   MSGINFO("DOES TABLE3 EXISTS ON DB ?"+CVALTOCHAR(hb_adoRddExistsTable( "Table3") ))

should be:
Code: Select all  Expand view
MSGINFO("DOES TABLE1 EXISTS ON DB ?"+CVALTOCHAR(hb_adoRddExistsTable( ,"Table1") ))
   MSGINFO("DOES TABLE3 EXISTS ON DB ?"+CVALTOCHAR(hb_adoRddExistsTable(, "Table3") ))
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Re: ADO RDD xHarbour

Postby byte-one » Tue Oct 20, 2015 12:45 pm

Antonio, i found the equivalent for MSSQL in function ADORECCOUNT(nWA,oRecordSet):

Code: Select all  Expand view
IF aAWData[ WA_ENGINE ] = "ACCESS" //.or. aAWData[ WA_ENGINE ] = "MSSQL"//6.08.15 ONLY WITH ACCESSIT TAKES LONGER IN BIG TABLES
      cSql := "SELECT MAX("+(ADO_GET_FIELD_RECNO( aAWData[WA_TABLENAME] ))+") FROM "+aAWData[WA_TABLENAME]
   ELSEIF aAWData[ WA_ENGINE ] = "MSSQL"
    cSql := "SELECT IDENT_CURRENT('"+aAWData[WA_TABLENAME]+"')+1 AS AUTO_INCREMENT"
   ELSE
      //30.06.15 REPLACED BY RAO NAGES IDEA next incremente key
      cSql := "SELECT AUTO_INCREMENT FROM INFORMATION_SCHEMA.TABLES"+;
              " WHERE TABLE_SCHEMA = '"+aAWData[ WA_CATALOG ]+"' AND TABLE_NAME = '"+aAWData[ WA_TABLENAME ]+"'"
   ENDIF
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Re: ADO RDD xHarbour

Postby AHF » Tue Oct 20, 2015 1:22 pm

Gunther,

Great!

In ACCESS its also needed
Code: Select all  Expand view

 cSql := "SELECT MAX("+(ADO_GET_FIELD_RECNO( aAWData[WA_TABLENAME] ))+")+1 FROM "+aAWData[WA_TABLENAME]
 


Is it working now with MSSQL?
Regards
Antonio H Ferreira
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Re: ADO RDD xHarbour

Postby Rick Lipkin » Tue Oct 20, 2015 2:25 pm

Gunther

I am just curious .. what are you trying to extract from the database .. a table structure, field attribute ?

Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2630
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: ADO RDD xHarbour

Postby byte-one » Tue Oct 20, 2015 2:39 pm

Antonio, Rick!

"SELECT IDENT_CURRENT('"+aAWData[WA_TABLENAME]+"')+1 AS AUTO_INCREMENT" i found in internet for MSSQL.

Antonio, there are a error with ACCESS!!!

Error description: Error ADODB.Recordset/6 DISP_E_UNKNOWNNAME: OPEN
Args:
[ 1] = C SELECT * FROM TABLE1 ORDER BY HBRECNO
[ 2] = O ADODB.Connection
[ 3] = N 2
[ 4] = N 3
[ 5] = N 0

Stack Calls
===========
Called from: => TOLEAUTO:OPEN( 0 )
Called from: C:\adordd\adordd.prg => ADO_OPEN( 318 )
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

Re: ADO RDD xHarbour

Postby AHF » Tue Oct 20, 2015 2:55 pm

Gunther,

Strange here its ok
Is the field HBRECNO in the table ?

What is your SET ADO CACHESIZE TO... ?
Regards
Antonio H Ferreira
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Re: ADO RDD xHarbour

Postby byte-one » Tue Oct 20, 2015 3:09 pm

Antonio, now i found that the .mdb is constructed but no tables inside!! -> Also the error comes from here.
I use this code:
Code: Select all  Expand view
DbCreate("table1;"+cPath+"\test2.mdb", .....


ADO CACHESIZE i do not use!
Regards,
Günther
---------------------------------
office@byte-one.com
User avatar
byte-one
 
Posts: 1048
Joined: Mon Oct 24, 2005 9:54 am
Location: Austria

PreviousNext

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], Ruth and 18 guests