Page 30 of 70

Re: ADO RDD xHarbour

PostPosted: Wed Apr 29, 2015 10:37 am
by Antonio Linares
Antonio,

I just sent an email to Mr. Rao asking him

Re: ADO RDD xHarbour

PostPosted: Wed Apr 29, 2015 5:26 pm
by AHF
New adordd version with working locking as dbfs at https://github.com/AHFERREIRA/adordd.git

This is still on trial and its working quite well on heavy transactions many records in many tables.
It assures completely record locking and concurrent access control like any other rdd.

The drawback is that we must use a dbf table in a network share with another rdd for this to work.
Its very small recsize only 50b and has a recycle scheme for records not needed.

Still have some issues with dates and NULL values in adordd.

Re: ADO RDD xHarbour

PostPosted: Thu Apr 30, 2015 8:26 am
by AHF
Antonio,

Any news regarding date functions?

Now Im taking care of :
copy to (cfile) WHILE ....

This function calls ADO_APPEND but the nWA received its a new one.
Probably this function selects a new area to copy file to.

Can we somehow change it or do we have to write a replacement from scratch.
Where can I find this function?

Re: ADO RDD xHarbour

PostPosted: Thu Apr 30, 2015 7:33 pm
by Antonio Linares
Antonio,

Code: Select all  Expand view
#pragma BEGINDUMP

#include <windows.h>
#include <hbapi.h>

HB_FUNC( FW_TTOD )
{
   hb_retdl( hb_pardl( 1 ) );
}

HB_FUNC( FW_DTOT )
{

#ifdef __XHARBOUR__
   hb_retdtl( hb_pardl( 1 ), hb_part( 1 ) );
#else
   long lJulian;
   long lMilliSecs;

   hb_partdt( &lJulian, &lMilliSecs, 1 );
   hb_rettdt( lJulian, lMilliSecs );
#endif
}

#pragma ENDDUMP
 

Re: ADO RDD xHarbour

PostPosted: Fri May 01, 2015 9:58 am
by AHF
Antonio,

Thanks for the code.

adordd its working almost perfectly.

Antonio, Mr Rao,

But I've still 2 pending problems:

1) Fields N without any decimal returning 2 decimals. (xxx.00) Do you have any idea what might be the problem.

2) Locates. Can you check the adordd.prg ado_locate to see what might be the problem?

If we do :

Code: Select all  Expand view

(calias)->(__dblocate( {|| namefiled->name = cNname} ))
 


The first time found following times not found.

Have you tried adordd?

Re: ADO RDD xHarbour

PostPosted: Fri May 01, 2015 3:29 pm
by Antonio Linares
Antonio,

1) Fields N without any decimal returning 2 decimals. (xxx.00) Do you have any idea what might be the problem.


Do you use any C code ? if yes then check if hb_retnd() is used somewhere and change it into hb_retnl()

Re: ADO RDD xHarbour

PostPosted: Fri May 01, 2015 3:30 pm
by Antonio Linares
Antonio,

2) Locates. Can you check the adordd.prg ado_locate to see what might be the problem?


Surely you need to do a oRecordSet:GoTop() before running the locate code.

Re: ADO RDD xHarbour

PostPosted: Fri May 01, 2015 9:46 pm
by AHF
Antonio,

Antonio Linares wrote:Antonio,

2) Locates. Can you check the adordd.prg ado_locate to see what might be the problem?


Surely you need to do a oRecordSet:GoTop() before running the locate code.


xHarbour help
<Scope>
This option defines the number of records to scan. It defaults to ALL. The NEXT <nCount> scope scans the next <nCount> records, while REST scans records beginning from the current record to the end of file. The search begins with the first record unless a scope is defined.


ADO_LOCATE code
Code: Select all  Expand view

STATIC FUNCTION ADO_LOCATE( nWA, lContinue )

   LOCAL aWAData := USRRDD_AREADATA( nWA )
   LOCAL oRecordSet := aWAData[ WA_RECORDSET ]

   
   IF ADOEMPTYSET(oRecordSet)
      RETURN HB_FAILURE
   ENDIF
 
   IF !lContinue
      oRecordSet:MoveFirst() //START FROM BEGINING
   ELSE
      oRecordSet:MoveNext() //WE DONT WANT TO FIND THIS ONE AGAIN
   ENDIF
   CURSORWAIT()
   DO WHILE !oRecordSet:EoF()
      [b]IF EVAL( aWAData[ WA_SCOPEINFO ][ UR_SI_BFOR ])[/b]
         aWAData[ WA_FOUND ] := .T.
         EXIT
      ENDIF 
      oRecordSet:MoveNext()
      SYSREFRESH()
   ENDDO
   CURSORARROW()
   
   aWAData[ WA_FOUND ] := ! oRecordSet:EOF
   aWAData[ WA_EOF ] := oRecordSet:EOF
 
   
   RETURN HB_SUCCESS
 


Somehow the eval() doesn't return .t. although is passing the record where it should.

Re: ADO RDD xHarbour

PostPosted: Fri May 01, 2015 9:54 pm
by AHF
Antonio Linares wrote:Antonio,

1) Fields N without any decimal returning 2 decimals. (xxx.00) Do you have any idea what might be the problem.


Do you use any C code ? if yes then check if hb_retnd() is used somewhere and change it into hb_retnl()


No hb_retnd() .
But if I used it and worked with other rdds should work also with adordd.

Any other idea?

Re: ADO RDD xHarbour

PostPosted: Fri May 01, 2015 9:56 pm
by Antonio Linares
Antonio,

Try this:

(calias)->(__dblocate( {|| MsgInfo( namefiled->name, cNname ), namefiled->name = cNname} ))

And check what it shows

> Fields N without any decimal returning 2 decimals. (xxx.00)

Try to check the size of the field and use int() when its not a decimal

Re: ADO RDD xHarbour

PostPosted: Sat May 02, 2015 8:10 am
by AHF
Antonio, Mr Rao,

Try to check the size of the field and use int() when its not a decimal


Solved!

In adofuncs.prg you have:
Code: Select all  Expand view
nLen     :=  Max( 19, oField:Precision + 2 )  


Shouldnt it be:
Code: Select all  Expand view
nLen     := Min( 19, oField:Precision  )   //


Otherwise we will have all fields much bigger because the minimum it will be 19.
Why not only oField:Precision?

Re: ADO RDD xHarbour

PostPosted: Sat May 02, 2015 8:12 am
by AHF
Antonio,

(calias)->(__dblocate( {|| MsgInfo( namefiled->name, cNname ), namefiled->name = cNname} ))

And check what it shows


It seems after 1st time a loose the codeblock I checking why.

Re: ADO RDD xHarbour

PostPosted: Sat May 02, 2015 12:16 pm
by nageswaragunupudi
AHF wrote:Antonio, Mr Rao,

Try to check the size of the field and use int() when its not a decimal


Solved!

In adofuncs.prg you have:
Code: Select all  Expand view
nLen     :=  Max( 19, oField:Precision + 2 )  


Shouldnt it be:
Code: Select all  Expand view
nLen     := Min( 19, oField:Precision  )   //


Otherwise we will have all fields much bigger because the minimum it will be 19.
Why not only oField:Precision?

Thanks. I am correcting Max to Min in adofuncs.prg.
+2 is for ( 1 decimal place and 1 minus sign )

Re: ADO RDD xHarbour

PostPosted: Sat May 02, 2015 4:11 pm
by AHF
Mr Rao,

+2 is for ( 1 decimal place and 1 minus sign )


In dbf when we say field,"N" ,11,4 the total length f the field is 11 but in fact one is taken for the "." decimal
so we only have 6,4 and if we want a minus we only have 5,4.
Shouldn't we use the same criteria in adordd ?

Besides that if we create a field, "N", 10 ,2 in ACCESS in adofuncs it is considered as "MONEY" why?

Re: ADO RDD xHarbour

PostPosted: Sat May 02, 2015 5:46 pm
by lucasdebeltran
Antonio,

Money must be used with 2 decimals because there is a bug with Access.