Page 9 of 70

Re: ADO RDD xHarbour

PostPosted: Tue Mar 24, 2015 9:10 pm
by Antonio Linares
very good :-)

I really wish that this ADO RDD gets completed and you are doing a great job :-)

AdoRdd will become a great tool for harbour/xHarbour users

Re: ADO RDD xHarbour

PostPosted: Wed Mar 25, 2015 10:24 am
by AHF
Antonio,

Do you have idea what function OrdKeyNo and OrdKeyCount are calling in RDD ?

Can you help me find that ?

I cannot find it!

Concerning the indexes with FOR clause to be transformed to WHERE clause for SQL. Is it common to be used in predefined indexes or only temporary indexes?
In our app we use it only in temporary indexes thus in the array of predefined indexes this situation is not forseen.

Do yo think its worth to cover it also?

Re: ADO RDD xHarbour

PostPosted: Wed Mar 25, 2015 1:09 pm
by Antonio Linares
Antonio,

Code: Select all  Expand view
HB_FUNC( ORDKEYNO )
{
   AREAP pArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer();

   if( pArea )
   {
      DBORDERINFO pOrderInfo;
      memset( &pOrderInfo, 0, sizeof( pOrderInfo ) );
      pOrderInfo.itmOrder = hb_param( 1, HB_IT_STRING | HB_IT_NUMERIC );
      pOrderInfo.atomBagName = hb_param( 2, HB_IT_STRING );
      /* Either or both may be NIL */
      pOrderInfo.itmNewVal = NULL;
      pOrderInfo.itmResult = hb_itemPutNL( NULL, 0 );
      SELF_ORDINFO( pArea, DBOI_POSITION, &pOrderInfo );
      hb_itemReturnRelease( pOrderInfo.itmResult );
   }
   else
      hb_errRT_DBCMD( EG_NOTABLE, EDBCMD_NOTABLE, NULL, HB_ERR_FUNCNAME );
}

Re: ADO RDD xHarbour

PostPosted: Wed Mar 25, 2015 1:10 pm
by Antonio Linares
Code: Select all  Expand view
HB_FUNC( ORDKEYCOUNT )
{
   AREAP pArea = ( AREAP ) hb_rddGetCurrentWorkAreaPointer();

   if( pArea )
   {
      DBORDERINFO pOrderInfo;
      memset( &pOrderInfo, 0, sizeof( pOrderInfo ) );
      pOrderInfo.itmOrder = hb_param( 1, HB_IT_STRING | HB_IT_NUMERIC );
      pOrderInfo.atomBagName = hb_param( 2, HB_IT_STRING );
      /* Either or both may be NIL */

      pOrderInfo.itmResult = hb_itemPutNL( NULL, 0 );
      SELF_ORDINFO( pArea, DBOI_KEYCOUNT, &pOrderInfo );
      hb_itemReturnRelease( pOrderInfo.itmResult );
   }
   else
      hb_errRT_DBCMD( EG_NOTABLE, EDBCMD_NOTABLE, NULL, HB_ERR_FUNCNAME );

}

Re: ADO RDD xHarbour

PostPosted: Wed Mar 25, 2015 1:11 pm
by Antonio Linares

Re: ADO RDD xHarbour

PostPosted: Wed Mar 25, 2015 1:12 pm
by Antonio Linares
FOR clause could be saved as a string and when you issue a SELECT command then you append FOR ...

SELECT * FROM customers FOR ...

Re: ADO RDD xHarbour

PostPosted: Wed Mar 25, 2015 2:01 pm
by AHF
Antonio,

Thanks I think see it now its ORDINFO :D

All locking already finished and it seems 100% compatible :D

FOR and UNIQUE on indexes are working
Its translate to WHERE clause and DISTINCT CLAUSE in selects. :lol:

We are now taking care of :

SCOPES to SELECT WHERE field BETWEEN value1 AND value2

Index clause NEXT translate to TOP n but for ex Oracle its ROWNUM we are checking how to solve these diferences between different SQLs

SEEK and FIND

SQLPARSER that we use already in other applications for ADS that transforms a normal old clipper filter expression to SQL SELECT taking in consideration active index.

I have a deadline for this part of the project to 27.03 so I hope to have all done till Friday and Ill post "clean" code after.

Still Fieldinfo its not working as we want. There are still problems with lenght and decimal places of DBF numeric fields types.

Can you find out with Mr Rao how to know or force that all recordsets are opened with the same connection obj.
This is imperative for transactions for locking concurrency

Now we ve a demand to prevent 100% SQL INJECTION. I have to study this ? Do you or Mr Rao have any ideas?

Cross your fingers as the most dificult part is still to come (RELATIONS)

Re: ADO RDD xHarbour

PostPosted: Wed Mar 25, 2015 2:12 pm
by Antonio Linares
Antonio,

I just sent an email to Mr. Rao asking him for his help.

You have all my support, hopefully you complete it :-)

Re: ADO RDD xHarbour

PostPosted: Wed Mar 25, 2015 2:46 pm
by Antonio Linares
Antonio,

Mr. Rao already answered me this:

1) Syntax of USE ... and DBUSEAREA.
2) Is the recordset opened by the ADORDD? If so how does the ADORDD knows the connection object? If ADORDD opens the recordset, does it open with connectionstring or a connection object?


Please answer whatever you know regarding these questions, thanks :-)

Re: ADO RDD xHarbour

PostPosted: Wed Mar 25, 2015 3:17 pm
by AHF
Antonio,

1) Syntax of USE ... and DBUSEAREA.


Exactly the same as for other Rdds

2) Is the recordset opened by the ADORDD?


Yes. With ADO_OPEN( nWA, aOpenInfo )

If so how does the ADORDD knows the connection object?


Its ADRDD that opens the connection object each time USE gets called
aWAData[ WA_CONNECTION ] := TOleAuto():New( "ADODB.Connection" )

If ADORDD opens the recordset, does it open with connectionstring or a connection object?


It does it with connection object opened as indicated above.
oRecordSet:Open( aWAData[ WA_TABLENAME ], aWAData[ WA_CONNECTION ])

The problem is if I save the connection object in a STATIC var and I use it for the next call to open new recordset the app crashes.

Re: ADO RDD xHarbour

PostPosted: Wed Mar 25, 2015 3:21 pm
by Antonio Linares
Antonio,

Do you mean this value ?

aWAData[ WA_CONNECTION ]

so you can't reuse it ?

thanks

Re: ADO RDD xHarbour

PostPosted: Wed Mar 25, 2015 3:23 pm
by Antonio Linares
Maybe you are closing it somewhere ?

Re: ADO RDD xHarbour

PostPosted: Wed Mar 25, 2015 3:59 pm
by AHF
Antonio,

The object its saved in the STATIC oADODB and its not released elsewere.

Code: Select all  Expand view


STATIC oADODB :=""

FUNCTION ADO_OPEN(.....
   IF EMPTY(oADODB)  //only first time
       aWAData[ WA_CONNECTION ] :=  TOleAuto():New( "ADODB.Connection" )
       aWAData[ WA_CONNECTION ]:OPEN(.....
       oADODB := aWAData[ WA_CONNECTION ]
   ELSE
        aWAData[ WA_CONNECTION ] :=oADODB
   ENDIF  
   oRecordSet :=  TOleAuto():New( "ADODB.Recordset" )
   oRecordSet:Open( aWAData[ WA_TABLENAME ], oADODB)

 

Re: ADO RDD xHarbour

PostPosted: Wed Mar 25, 2015 4:05 pm
by Antonio Linares
Antonio,

Where is it crashing ?

Have you traced the code to check where it crashes ?

Please place some MsgInfo()s or use OutputDebugString( cMsg ) (remember to load dbwin32.exe first).

Re: ADO RDD xHarbour

PostPosted: Wed Mar 25, 2015 4:08 pm
by AHF
Antonio,

oRecordSet:Open(...