ADO RDD xHarbour

Re: ADO RDD xHarbour

Postby AHF » Tue May 05, 2015 9:05 am

Antonio Linares wrote:Antonio,

Have you look for those UR_ defines in all Harbour sources ?


Yes. In dbcmd.c

Code: Select all  Expand view  RUN

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
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Re: ADO RDD xHarbour

Postby Antonio Linares » Tue May 05, 2015 9:20 am

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
User avatar
Antonio Linares
Site Admin
 
Posts: 42120
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: ADO RDD xHarbour

Postby elvira » Tue May 05, 2015 10:53 am

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...
elvira
 
Posts: 516
Joined: Fri Jun 29, 2012 12:49 pm

Re: ADO RDD xHarbour

Postby AHF » Tue May 05, 2015 10:59 am

Elvira,

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

Re: ADO RDD xHarbour

Postby AHF » Tue May 05, 2015 11:05 am

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
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Re: ADO RDD xHarbour

Postby elvira » Tue May 05, 2015 11:13 am

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
elvira
 
Posts: 516
Joined: Fri Jun 29, 2012 12:49 pm

Re: ADO RDD xHarbour

Postby AHF » Tue May 05, 2015 11:42 am

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
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Re: ADO RDD xHarbour

Postby elvira » Tue May 05, 2015 11:56 am

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.
elvira
 
Posts: 516
Joined: Fri Jun 29, 2012 12:49 pm

Re: ADO RDD xHarbour

Postby AHF » Tue May 05, 2015 12:19 pm

Elvira,

Are you linking dbfcdx rdd ?

What version are you using see adoversion please.

Whats this HBDIRBASE ? Im using xHarbour.
Regards
Antonio H Ferreira
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Re: ADO RDD xHarbour

Postby elvira » Tue May 05, 2015 12:31 pm

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  Expand view  RUN


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


 
elvira
 
Posts: 516
Joined: Fri Jun 29, 2012 12:49 pm

Re: ADO RDD xHarbour

Postby AHF » Tue May 05, 2015 1:15 pm

Elvira,

You must have HB_RECNO or other autoinc type field in your tables and indicate its name to adordd .
Regards
Antonio H Ferreira
AHF
 
Posts: 838
Joined: Fri Feb 10, 2006 12:14 pm

Re: ADO RDD xHarbour

Postby elvira » Tue May 05, 2015 1:22 pm

I do have it:

SET ADO DEFAULT RECNO FIELD TO "ID"
elvira
 
Posts: 516
Joined: Fri Jun 29, 2012 12:49 pm

Re: ADO RDD xHarbour

Postby AHF » Tue May 05, 2015 1:26 pm

Elvira,

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

Re: ADO RDD xHarbour

Postby elvira » Tue May 05, 2015 1:56 pm

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
elvira
 
Posts: 516
Joined: Fri Jun 29, 2012 12:49 pm

Re: ADO RDD xHarbour

Postby AHF » Tue May 05, 2015 2:21 pm

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  Expand view  RUN

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
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 64 guests