ADO RDD xHarbour

Re: ADO RDD xHarbour

Postby AHF » Wed Nov 18, 2015 11:10 am

Gunther,

Im trying with

ACTIVATE WINDOW oWnd VALID ;
FimPrograma(ownd,oTimer)

The FimPrograma does not quit and even so the message is shown only ADO_EXIT but without any procs.
Regards
Antonio H Ferreira
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Re: ADO RDD xHarbour

Postby AHF » Wed Nov 18, 2015 11:14 am

Gunther,

If you need you can call directly ADODB_CLOSE() in order to close all tables, sets and connection thats what ADO_EXIT does.

I though ADO_EXIT would be called in any circumstance besides errors.
Regards
Antonio H Ferreira
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Re: ADO RDD xHarbour

Postby byte-one » Wed Nov 18, 2015 1:03 pm

Antonio, for now i insert ADODB_CLOSE() in the valid from my main-window.

Another points to discuss i found on transfer my app to adordd is:
1.) If i fill the index-array the order cannot changing with SET INDEX TO .... In some cases this is required if i will not change the code.
2.) Opening the same DBF with 2 or more USE and different aliases is in other RDD possible. In ADORDD?
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 » Wed Nov 18, 2015 1:43 pm

Gunther,

1.) If i fill the index-array the order cannot changing with SET INDEX TO .... In some cases this is required if i will not change the code.

Sorry I cant understand what you mean.
SET INDEX TO its translated by the preprocessor to ordlistadd() as in clipper adordd SET ORDER to the 1st index in the SET INDEX TO.

Is it not working like that?

Can you post an example?

2.) Opening the same DBF with 2 or more USE and different aliases is in other RDD possible. In ADORDD?

It works like any other rdd you everything continues the same.
My apps work just like that and its 100% ok.
Regards
Antonio H Ferreira
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Re: ADO RDD xHarbour

Postby byte-one » Thu Nov 19, 2015 9:30 am

Antonio,
SET INDEX TO index1,index2,... or USE....INDEX index1,index2,... describes only the order from indexfiles. As in ADORDD no files exist i must use before INDEX ON... (in a clipper app only once to produce the indexfile) or the command SET ADODBF TABLES INDEX LIST TO ....
If i use this ADODBF TABLES INDEX LIST TO .... then the order from the indexes always like this array. The SET INDEX TO... or USE..INDEX TO... are not respected!
You write in a message before that this array are always on first ranking and after this the indexes with INDEX ON... added.
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 » Thu Nov 19, 2015 9:56 am

Gunther,

USE cTable
SET INDEX TO index1,index2,index3

Order focus should be index1. If SET AUTOPEN ON the order focus will be on the first index in the SET ADODBF..

You should only use INDEX ON for temporary indexes as permanent ones should be indicated on SET ADODBF INDEX...

If you use INDEX ON... TO cFile the cFile name must be present the min 4 first letters in ADO SET TEMPORARY NAMES... otherwise will never be opened.

You can use this to check the status of tables,aliases, locks, relations and indexes per area.

Code: Select all  Expand view  RUN

FUNCTION expalias()
LOCAL cerrorlog := "",n,j,ntarget,x

   for n = 1 to 255
      if ! Empty( Alias( n ) )
         cErrorLog += CRLF + Str( n, 3 ) + ": " + If( Select() == n,"=> ", "   " ) + ;
                      PadR( Alias( n ), 15 ) + Space( 20 ) + "NomeRDD: " + ;
                      ( Alias( n ) )->( RddName() ) + CRLF
         cErrorLog += "     ==============================" + CRLF
         cErrorLog += "     RecNo    RecCount    BOF   EOF" + CRLF
         cErrorLog += "    " + Transform( ( Alias( n ) )->( RecNo() ), "99999" ) + ;
                      "      " + Transform( ( Alias( n ) )->( RecCount() ), "99999" ) + ;
                      "      " + cValToChar( ( Alias( n ) )->( BoF() ) ) + ;
                      "   " + cValToChar( ( Alias( n ) )->( EoF() ) ) + CRLF + CRLF
         cErrorLog += "     Used indexes " + Space( 23 ) + "TagName" + CRLF
         for j = 1 to 15
            if ! Empty( ( Alias( n ) )->( IndexKey( j ) ) )
               cErrorLog += Space( 8 ) + ;
                            If( ( Alias( n ) )->( IndexOrd() ) == j, "=> ", "   " ) + ;
                            PadR( ( Alias( n ) )->( IndexKey( j ) ), 35 ) + ;
                            ( Alias( n ) )->( OrdName( j ) ) + ;
                            CRLF
            endif
         next
         cErrorLog += CRLF + "     Relações em uso " + CRLF
         for j = 1 to 8
            if ! Empty( ( nTarget := ( Alias( n ) )->( DbRSelect( j ) ) ) )
               cErrorLog += Space( 8 ) + Str( j ) + ": " + ;
                            "TO " + ( Alias( n ) )->( DbRelation( j ) ) + ;
                            " INTO " + Alias( nTarget ) + CRLF
               // uValue = ( Alias( n ) )->( DbRelation( j ) )
               // cErrorLog += cValToChar( &( uValue ) ) + CRLF
            endif
         next
      x :=  (alias(n))->(dbrlocklist())
      cErrorLog += Space( 8 ) +"Locked records "+CRLF
      for j = 1 to len(x)
          cErrorLog += Space( 8 ) + "Recno "+str(x[j])+CRLF
      next

      endif
   next
   SHOWMEMO(cerrorlog)

RETURN .t.

 


Can you post a small trial and the that trial table index array in SET ADODBF... ?
Regards
Antonio H Ferreira
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Re: ADO RDD xHarbour

Postby AHF » Thu Nov 19, 2015 9:58 am

Gunther,

You write in a message before that this array are always on first ranking and after this the indexes with INDEX ON... added.


Just lie any other rdd INDEX ON without ADDITIVE clause will clear all the orders prior to creation.
Regards
Antonio H Ferreira
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Re: ADO RDD xHarbour

Postby AHF » Thu Nov 19, 2015 2:58 pm

Gunther,

Is the problem solved ?

Im looking into indexes with SQLite right now so if you need something please let me know.
Regards
Antonio H Ferreira
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Re: ADO RDD xHarbour

Postby byte-one » Thu Nov 19, 2015 3:50 pm

Antonio, i test now my app and have wrote a little testprogram. I send you tomorrow the results!
Greetings from Austria!
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 » Fri Nov 20, 2015 9:45 am

Antonio, after testing i can say: All is right!

Suggestions:
For the local (.ctl, files with text "nada") files you should also set a path ex.: <app>\adordd or the temp from windows as we should not write into the app-path (and/or a SET order)!
The text "nada" should more international.
SET ADO INDEX UDFS TO should contain for standard SUBS and SUBSTR.
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 » Fri Nov 20, 2015 10:08 am

Gunther,

Antonio, after testing i can say: All is right!


Great !

For the local (.ctl, files with text "nada") files you should also set a path ex.: <app>\adordd or the temp from windows as we should not write into the app-path (and/or a SET order)!


These files are only created when SET ADO LOCK ON and at the path of SET ADO LOCK CONTROL SHAREPATH TO so you can choose whatever path you want.
These files are only created to simulate USE EXCLUSIVE / SHARED as they are opened with FOPEN( (cFile), IF(lExclusive, FO_EXCLUSIVE, FO_DENYNONE ) )

The text "nada" should more international.


Nada means nothing I think its international.

SET ADO INDEX UDFS TO should contain for standard SUBS and SUBSTR.


You can place here any functions you want.
In principle should be present here all ones that are not only to convert data types, such as SUBSTR for ex.
The ones that alter the value, length of a field must be present here.
Regards
Antonio H Ferreira
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Re: ADO RDD xHarbour

Postby byte-one » Fri Nov 20, 2015 11:35 am

Antonio.
In principle should be present here all ones that are not only to convert data types, such as SUBSTR for ex.
The ones that alter the value, length of a field must be present here.

Also upper() and so on should be in this list?
And whats ex. should not to be in list?
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 » Fri Nov 20, 2015 12:25 pm

Gunther,

We normally use index functions to convert all index keys to the same data type.
INDEX ON STR(NUM)+DTOS(DATE)+CVALTCHAR(LOGIC)

These kind of functions dont alter the data itself but only the type in order that can be evaluated without errors.
These kind of functions you dont need and should not use them in ADO UDF.

But for instances if we do instead
INDEX ON STR(NUM)+DTOS(DATE)+IF( LOGIC , "yes", "no")

Then we need to include in ADO UDF - IF to tell adordd that this index its a different one.
The same with UPPER, SUBSTR, ==, PAD, etc.

But you should only place them in ADO UDF if in fact they are used in your app in index expressions otherwise you dont need to take the time to do it.

Besides these you need there all true User Defined Functions.

Please note that if you place DTOS in ADO UDF all indexes with that function will be created in an array and after sorted. This array of bookmarks its then set in ado :filter method.
This is expensive to create and maintained in big tables and should be only used when truly needed.

Is this clear to you?
Regards
Antonio H Ferreira
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Re: ADO RDD xHarbour

Postby AHF » Fri Nov 20, 2015 12:58 pm

New build adordd ver 1.0 at https://github.com/AHFERREIRA/adordd.git

Corrected bugs:

APPEND with SQLITE, FIREBIRD, POSTGRE and ORACLE with index with UDF or condition was
adding the same bookmark twice.

ADO_REQUERY could fall into recursive calls after append new record using engines
Sqlite, FireBird Postgre and Oracle.

DBGOTO was giving error if the record was not within INDEX with UDF or condition.


Changes:

hb_AdoRddFile( cFile ) Check for index file in the adodbf index list... and support for Sqlite, Firebird, Oracle.
Regards
Antonio H Ferreira
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Re: ADO RDD xHarbour

Postby AHF » Thu Nov 26, 2015 5:47 pm

New build adordd ver 1.0 at https://github.com/AHFERREIRA/adordd.git

Corrected Bugs:

1) FIELDNAME was not returning upper fieldname in case of db engine PostGre, Oracle

2) Some upper case conversions to take care of lower case fields used by PostGre and Oracle.

3) Reserved keywords used in fields taken care with PostGre and Oracle.

4) SET TRESHOLD was not finding aMask if used table and SQL were with different case. Now all upper case.

5) Pre opening of recorsets optimized and cached for different where clauses on same table.
If the table its below the SET THRESHOLD and its already opened in another work area the set its not created again but cloned from that work area.
If during app run time a table passes the SET THRESHOLD value its cached next time is opened.

Tested engines:

ACCESS
ADS
DBASE
FIREBIRD
FOXPRO
MS SQL
MYSQL
POSTGRE
SQLITE

Still not tested but should work ok:

ANYWHERE
INFORMIX
MARIADB
ORACLE
Regards
Antonio H Ferreira
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

PreviousNext

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 24 guests