ADO RDD xHarbour

AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

Re: ADO RDD xHarbour

Post by AHF »

Antonio Linares wrote:Antonio,

Have you look for those UR_ defines in all Harbour sources ?
Yes. In dbcmd.c

Code: Select all

HB_FUNC( HB_DBDROP )
{
   LPRDDNODE  pRDDNode;
   HB_USHORT  uiRddID;
   HB_ULONG   ulConnection;
   const char * szDriver;
   PHB_ITEM   pName;

   szDriver = hb_parc( 3 );
   if( !szDriver ) /* no VIA RDD parameter, use default */
   {
      szDriver = hb_rddDefaultDrv( NULL );
   }
   ulConnection = hb_parnl( 4 );

   pRDDNode = hb_rddFindNode( szDriver, &uiRddID );  /* find the RDDNODE */
   pName = hb_param( 1, HB_IT_STRING );

   if( pRDDNode && pName )
      hb_retl( SELF_DROP( pRDDNode, pName, hb_param( 2, HB_IT_STRING ),
                          ulConnection ) == HB_SUCCESS );
   else
      hb_errRT_DBCMD( EG_ARG, EDBCMD_EVAL_BADPARAMETER, NULL, HB_ERR_FUNCNAME );
}

HB_FUNC( HB_DBEXISTS )
{
   LPRDDNODE  pRDDNode;
   HB_USHORT  uiRddID;
   HB_ULONG   ulConnection;
   const char * szDriver;
   PHB_ITEM   pName;

   szDriver = hb_parc( 3 );
   if( !szDriver ) /* no VIA RDD parameter, use default */
      szDriver = hb_rddDefaultDrv( NULL );

   ulConnection = hb_parnl( 4 );

   pRDDNode = hb_rddFindNode( szDriver, &uiRddID );  /* find the RDD */
   pName = hb_param( 1, HB_IT_STRING );

   if( pRDDNode && pName )
      hb_retl( SELF_EXISTS( pRDDNode, pName, hb_param( 2, HB_IT_STRING ),
                            ulConnection ) == HB_SUCCESS );
   else
      hb_errRT_DBCMD( EG_ARG, EDBCMD_EVAL_BADPARAMETER, NULL, HB_ERR_FUNCNAME );
}
 
It seems to me that this has to do with rdddriver and not table.

I think we dont need this. Right?
Regards
Antonio H Ferreira
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: ADO RDD xHarbour

Post by Antonio Linares »

Antonio,

It looks like a cleaning on exit if needed.

If you don't need it to clean anything, then you don't need it.
regards, saludos

Antonio Linares
www.fivetechsoft.com
elvira
Posts: 462
Joined: Fri Jun 29, 2012 12:49 pm

Re: ADO RDD xHarbour

Post by elvira »

Hello,

Is not working. I get this error:

Error description: Error BASE/1081 Argument error: +
Args:
[ 1] = U
[ 2] = C .DBF

Stack Calls
===========
Called from: test.prg => ADO_OPENSHARED( 2670 )

_ > DBUSEAREA(.T.,aLockCtrl[2],aLockCtrl[1]+".DBF","TLOCKS",.T.)

Called from: test.prg => ADO_OPEN( 241 )
Called from: => DBUSEAREA( 0 )
Called from: test.prg => MAIN( 59 )


Is anyone testing this?. It seems that no...
AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

Re: ADO RDD xHarbour

Post by AHF »

Elvira,

Please post here test.prg
Regards
Antonio H Ferreira
AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

Re: ADO RDD xHarbour

Post by AHF »

Antonio,

I'm working "copy to" but guessing what to do because there isn't any documentation.

Please inform what is in aFieldsStru I see some code blocks but I have no idea what it is.

__dbTrans( nDstArea, aFieldsStru, bFor, bWhile, nNext, nRecord, lRest )

are these parameters correcto for UR_TRANS?

Also parameters for UR_TRANSREC and what is for.
Regards
Antonio H Ferreira
elvira
Posts: 462
Joined: Fri Jun 29, 2012 12:49 pm

Re: ADO RDD xHarbour

Post by elvira »

Sure,

#include "fivewin.ch"

#include "adordd.prg"



REQUEST ADORDD

function Main()

RDDSETDEFAULT( "ADORDD" )

SET ADODBF TABLES INDEX LIST TO {{ "TEST", {"TEST1", "FIRST"} ,;
{"TEST2", "LAST"} ,;
{"TEST3", "AGE"} }}

SET ADO TABLES INDEX LIST TO {{ "TEST", {"TEST1", "FIRST"} ,;
{"TEST2", "LAST"} ,;
{"TEST3", "AGE"} }}


SET ADO DEFAULT RECNO FIELD TO "HBRECNO"

SET AUTOPEN ON //might be OFF if you wish
SET AUTORDER TO 1 // first index opened can be other


SET ADO DEFAULT DATABASE TO "TEST2.mdb" ENGINE TO "ACCESS" USER TO "" PASSWORD TO ""

SET ADO LOCK CONTROL SHAREPATH TO "C:\" RDD TO "DBFCDX"



IF !FILE( "test2.mdb" )

DbCreate( "test2.mdb;table1", { { "FIRST", "C", 30, 0 },;
{ "LAST", "C", 30, 0 },;
{ "AGE", "N", 8, 0 } }, "ADORDD" )
ENDIF



USE TABLE1 NEW ALIAS "TEST2"
TEST2->( OrdSetFocus("TEST2") )

msginfo(ordsetfocus())

DbGoTop()

XBROWSER FASTEDIT


DbCloseAll()




return nil
AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

Re: ADO RDD xHarbour

Post by AHF »

Elvira,

Please try:

SET ADO LOCK CONTROL SHAREPATH TO "C:" RDD TO "DBFCDX" //cant use final "\"

SET ADO TABLES INDEX LIST and SET ADODBF TABLES INDEX LIST TO
the name is of the table not the alias.

And add HB_RECNO when creating the tables. This field its not auto creates by ado.

Please let me know result.

Thanks
Regards
Antonio H Ferreira
elvira
Posts: 462
Joined: Fri Jun 29, 2012 12:49 pm

Re: ADO RDD xHarbour

Post by elvira »

Antonio,

I did those changes, and I still get:

Time from start: 0 hours 0 mins 0 secs
Error occurred at: 05/05/15, 13:53:30
Error description: Error DBCMD/1015 Argument error: DBUSEAREA

Stack Calls
===========
Called from: => DBUSEAREA( 0 )
Called from: test.prg => ADO_OPENSHARED( 2670 )

-> DBUSEAREA(.T.,aLockCtrl[2],aLockCtrl[1]+".DBF","TLOCKS",.T.)


By the way, in order to have ADORDD more clear, SET ADO LOCK CONTROL SHAREPATH should be by default HBDIRBASE(), without needing to specify it. The same for SET ADO DEFAULT RECNO FIELD.

Thank you.
AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

Re: ADO RDD xHarbour

Post by AHF »

Elvira,

Are you linking dbfcdx rdd ?

What version are you using see adoversion please.

Whats this HBDIRBASE ? Im using xHarbour.
Regards
Antonio H Ferreira
elvira
Posts: 462
Joined: Fri Jun 29, 2012 12:49 pm

Re: ADO RDD xHarbour

Post by elvira »

Antonio,
I am using "AdoRdd Version 1.040515/1"

I linked DBFCDX and now I get another error:

Error description: Error ADORDD/1022 Lock required: TABLE1

Stack Calls
===========
Called from: => UR_SUPER_ERROR( 0 )
Called from: test.prg => ADO_PUTVALUE( 1276 )
Called from: test.prg => MAIN( 72 )

And also:

Error description: Error ADORDD/1022 Lock required: TABLE1

Stack Calls
===========
Called from: => UR_SUPER_ERROR( 0 )
Called from: test.prg => ADO_DELETE( 1068 )
Called from: => DBDELETE( 0 )
Called from: .\source\classes\XBROWSE.PRG => (b)TXBROWSE_SETRDD( 4153 )
Called from: .\source\classes\XBROWSE.PRG => (b)TXBROWSE( 632 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:DELETE( 0 )
Called from: .\source\function\XBROWSER.PRG => (b)XBROWSE( 137 )
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:CLICK( 522 )
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:LBUTTONUP( 752 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1723 )
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:HANDLEEVENT( 1601 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3345 )
Called from: => DIALOGBOXINDIRECT( 0 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 286 )
Called from: .\source\function\XBROWSER.PRG => XBROWSE( 220 )
Called from: test.prg => MAIN( 68 )



hb_dirbase() is

Code: Select all


function hb_DIRBASE()
return cFilePath( GetModuleFileName( GetInstance() )  )


 
AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

Re: ADO RDD xHarbour

Post by AHF »

Elvira,

You must have HB_RECNO or other autoinc type field in your tables and indicate its name to adordd .
Regards
Antonio H Ferreira
elvira
Posts: 462
Joined: Fri Jun 29, 2012 12:49 pm

Re: ADO RDD xHarbour

Post by elvira »

I do have it:

SET ADO DEFAULT RECNO FIELD TO "ID"
AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

Re: ADO RDD xHarbour

Post by AHF »

Elvira,

Please post prg.
Regards
Antonio H Ferreira
elvira
Posts: 462
Joined: Fri Jun 29, 2012 12:49 pm

Re: ADO RDD xHarbour

Post by elvira »

Sure,

REQUEST ADORDD, DBFCDX

function Main()

local aArray := {}


RDDSETDEFAULT( "ADORDD" )

SET ADODBF TABLES INDEX LIST TO {{ "TEST2", {"TEST1", "FIRST"} ,;
{"TEST2", "LAST"} ,;
{"TEST3", "AGE"} }}

SET ADO TABLES INDEX LIST TO {{ "TEST2", {"TEST1", "FIRST"} ,;
{"TEST2", "LAST"} ,;
{"TEST3", "AGE"} }}



SET ADO DEFAULT RECNO FIELD TO "ID"

SET AUTOPEN ON //might be OFF if you wish
SET AUTORDER TO 1 // first index opened can be other


SET ADO DEFAULT DATABASE TO "TEST2.mdb" ENGINE TO "ACCESS" USER TO "" PASSWORD TO ""

SET ADO LOCK CONTROL SHAREPATH TO "C:" RDD TO "DBFCDX"



IF !FILE( "test2.mdb" )

DbCreate( "test2.mdb;table1", { { "FIRST", "C", 30, 0 },;
{ "LAST", "C", 30, 0 },;
{ "AGE", "N", 8, 0 } }, "ADORDD" )
ENDIF



USE TABLE1 NEW ALIAS "TEST2"


TEST2->( OrdSetFocus("TEST2") )

msginfo(ordsetfocus())




XBROWSER FASTEDIT

DbCloseAll()




return nil
AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

Re: ADO RDD xHarbour

Post by AHF »

Elvira,

You must do it like this:

Please note table1 instead of test2 in SET ADO... TABLES as the indexes are related to tables not to DBs and ID field in dbcreate.

Like this should work ok.

Code: Select all

SET ADODBF TABLES INDEX LIST TO {{ "TABLE1", {"TEST1", "FIRST"} ,;
{"TEST2", "LAST"} ,;
{"TEST3", "AGE"} }}

SET ADO TABLES INDEX LIST TO {{ "TABLE1", {"TEST1", "FIRST"} ,;
{"TEST2", "LAST"} ,;
{"TEST3", "AGE"} }}



SET ADO DEFAULT RECNO FIELD TO "ID"

SET AUTOPEN ON //might be OFF if you wish
SET AUTORDER TO 1 // first index opened can be other


SET ADO DEFAULT DATABASE TO CPATH+"TEST2.mdb" ENGINE TO "ACCESS" USER TO "" PASSWORD TO ""

SET ADO LOCK CONTROL SHAREPATH TO "C:" RDD TO "DBFCDX"



IF !FILE( "test2.mdb" )

DbCreate( "test2.mdb;table1", { { "FIRST", "C", 30, 0 },;
{ "LAST", "C", 30, 0 },;
{ "AGE", "N", 8, 0 } 
{ "ID" ,"+",10, 0}  }, "ADORDD" )

ENDIF

 
Regards
Antonio H Ferreira
Post Reply