ADO RDD xHarbour

User avatar
lucasdebeltran
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am
Contact:

Re: ADO RDD xHarbour

Post by lucasdebeltran »

Antonio,

Does append blank and replace work?.

In my tests from last week once the aplication was closed, data were lost.

Antonio L., please wait to the announcment.

Thank you.
Muchas gracias. Many thanks.

Un saludo, Best regards,

Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]

Implementando MSVC 2010, FWH64 y ADO.

Abandonando uso xHarbour y SQLRDD.
hmpaquito
Posts: 1200
Joined: Thu Oct 30, 2008 2:37 pm

Re: ADO RDD xHarbour

Post by hmpaquito »

Ahf and others: thanks and congratulations.
I have saw announcement on xharbour forum but no on harbour forum.
is adordd harbour/xharbour compatible ? Is it operative in production environment ?

Regards
User avatar
thefull
Posts: 720
Joined: Fri Oct 07, 2005 7:42 am
Location: Barcelona
Contact:

Re: ADO RDD xHarbour

Post by thefull »

Please,

Put simple test.prg for diferents test, in github.
I like test under Sql Server and MySql.

Regards.
Saludos
Rafa Carmona ( rafa.thefullARROBAgmail.com___quitalineas__)
User avatar
lucasdebeltran
Posts: 1303
Joined: Tue Jul 21, 2009 8:12 am
Contact:

Re: ADO RDD xHarbour

Post by lucasdebeltran »

Rafa,

Code: Select all


#include "fivewin.ch"

function Main()

   local aArray := {}

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

  endif



   USE test2.mdb VIA "ADORDD" TABLE "table1" NEW

browse()


   APPEND BLANK
   test2->First   := "HOMER si no Homer"
   test2->Last    := "Simpson"
   test2->Age     := 45

   APPEND BLANK
   test2->First   := "aaa Lara"
   test2->Last    := "Croft si no"
   test2->Age     := 32


   GO TOP

  XBROWSER FASTEDIT
   DbCloseAll()




return nil

 


Muchas gracias. Many thanks.

Un saludo, Best regards,

Harbour 3.2.0dev, Borland C++ 5.82 y FWH 13.06 [producción]

Implementando MSVC 2010, FWH64 y ADO.

Abandonando uso xHarbour y SQLRDD.
AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

Re: ADO RDD xHarbour

Post by AHF »

lucasdebeltran wrote:Antonio,

Does append blank and replace work?.

In my tests from last week once the aplication was closed, data were lost.

Antonio L., please wait to the announcment.

Thank you.
Lucas,
The problem is with transactions please check adorrd.prg and try inhibiting transactions or try issue dbcommit() and check if it is ok.

Replace Im trying it seems to be ok.

:AddNew() is disrupted not ok anymore! (append)
The reason is that in order to enable seek expression like we do normally I had to add one more field to the selects that is INDEXKEY.

ex:
INDEX ON field1+field2+field3 TO xfile
SET INDEX TO xfile

when select

SELECT *.xfile, (field1+field2+field3) AS INDEXKEY ORDER BY field1,field2,field3
if the cursor is adUseClient INDEXKEY gets indexed by ADO.

This enable you to seek in any part of the seek key.

DBSEEK( SPACE(LEN(field1))+"whatever")
.or.
DBSEEK("whatever")

Now because INDEXKEY does not really exists in the table when we call :addnew() we get error.

Im trying to solve it.
Its an ADO problem because with SQL INSERT works ok.

May be M Rao or Enrico can give us a hand?
Regards
Antonio H Ferreira
AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

Re: ADO RDD xHarbour

Post by AHF »

hmpaquito wrote:Ahf and others: thanks and congratulations.
I have saw announcement on xharbour forum but no on harbour forum.
is adordd harbour/xharbour compatible ? Is it operative in production environment ?

Regards
adordd is harbour/xharbour compatible.

There are still for sure many bugs but what is most important its to understand if the approach that Im convinced will work with almost or even no code changes in apps.
Having as many people as possible trying will help to solve all the issues more rapidly.
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 »

Having as many people as possible trying will help to solve all the issues more rapidly
+1
regards, saludos

Antonio Linares
www.fivetechsoft.com
AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

Re: ADO RDD xHarbour

Post by AHF »

Antonio,
:AddNew() is disrupted not ok anymore! (append)
The reason is that in order to enable seek expression like we do normally I had to add one more field to the selects that is INDEXKEY.
Now because INDEXKEY does not really exists in the table when we call :addnew() we get error.

Im trying to solve it.
Its an ADO problem because with SQL INSERT works ok.

May be M Rao, Enrico can give us a hand?
I cannot find anywhere if this is a ADO limitation or if there is another way to do it!
With this would be much easy to adapt it to existing apps.
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,

I have emailed Mr. Rao asking for his advice
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
thefull
Posts: 720
Joined: Fri Oct 07, 2005 7:42 am
Location: Barcelona
Contact:

Re: ADO RDD xHarbour

Post by thefull »

Buenas, seria bueno quitar todo referente a Fivewin, para que sea más fácil compilar.
Por ejemplo,

Code: Select all

#ifndef __XHARBOUR__

   #xcommand TRY  => BEGIN SEQUENCE WITH {| oErr | Break( oErr ) }
   #xcommand CATCH [<!oErr!>] => RECOVER [USING <oErr>] <-oErr->
   #xcommand FINALLY => ALWAYS
 
   #define UR_FI_FLAGS           6
   #define UR_FI_STEP            7
   #define UR_FI_SIZE            5 // by Lucas for Harbour


#endif

function cValToChar( u ); return CStr( u )
function MsgInfo( u ) ; return Alert( u )
function MsgAlert( u ); return Alert( u )

function cFilePath( cPathMask )   // returns path of a filename

   local n := RAt( "\", cPathMask ), cDisk

return If( n > 0, Upper( Left( cPathMask, n ) ),;
           ( cDisk := cFileDisc( cPathMask ) ) + If( ! Empty( cDisk ), "\", "" ) )

function cFileNoPath( cPathMask )  

    local n := RAt( "\", cPathMask )

return If( n > 0 .and. n < Len( cPathMask ),;
           Right( cPathMask, Len( cPathMask ) - n ),;
           If( ( n := At( ":", cPathMask ) ) > 0,;
           Right( cPathMask, Len( cPathMask ) - n ),;
           cPathMask ) )

function cFileNoExt( cPathMask ) // returns the filename without ext

   local cName := AllTrim( cFileNoPath( cPathMask ) )
   local n     := RAt( ".", cName )

return AllTrim( If( n > 0, Left( cName, n - 1 ), cName ) )

function cFileDisc( cPathMask )  // returns drive of the path

return If( At( ":", cPathMask ) == 2, ;
           Upper( Left( cPathMask, 2 ) ), "" )

#pragma BEGINDUMP
#include <hbapi.h>

HB_FUNC( LAND )
{
   hb_retl( ( hb_parnl( 1 ) & hb_parnl( 2 ) ) != 0 );
}

#pragma ENDDUMP

Lucas, con harbour, en la linea 1621

Code: Select all

       IF TABLES_WITH_FIELD_HB_RECNO 
          //create ado index only with adUseClient
          IF oRecordSet:CursorLocation = adUseClient
             oRecordSet:Fields( oRecordSet:Fields:Count -1 ):Properties("Optimize") := 1  // AQUI CASCA!!
          ENDIF
       ENDIF   


Esto es lo que suelta, de momento

Code: Select all

c:\adotest>hbmk2 test.hbm
Harbour 3.2.0dev (r1411121701)
Copyright (c) 1999-2014, http://harbour-project.org/
Compiling 'test.prg'...
Lines 377, Functions/Procedures 1
Generating C source output to 'C:\Users\rafa\AppData\Local\Temp\hbmk_st8wdm.dir\test.c'... Done.
Compiling 'adordd.prg'...
adordd.prg(1621) Error E0022  Invalid lvalue ':'
Mi hbmk que uso;

Code: Select all

hbblink.hbc
hbwin.hbc

-lxhb -lgtwin -lgtwvg -lgtgui -lhbwin -lhbmisc -lhbxpp -lhbct 
-ic:/programacion/harbour3/include;c:\programacion\harbour32\contrib\xhb

-otest
-w0
-es1
-mt

test.prg
adordd.prg
De todas maneras, no funciona el test que me has enviado...

C:\adotest>test

Error WINOLE/1007 No se pudo encontrar el archivo 'C:\programacion\pms\adordd\test2.mdb'. (0x80004005ft JET Database Engine (DOS Error -2147352567)
Called from TOLEAUTO:OPEN(0)
Called from ADO_OPEN(232)
Called from DBUSEAREA(0)
Called from MAIN(18)

Miraré por que no lo crea...

Saludos Cordiales
Saludos
Rafa Carmona ( rafa.thefullARROBAgmail.com___quitalineas__)
User avatar
thefull
Posts: 720
Joined: Fri Oct 07, 2005 7:42 am
Location: Barcelona
Contact:

Re: ADO RDD xHarbour

Post by thefull »

Uy, faltaba meterle un REQUEST HB_GT_WVT_DEFAULT para ver que hace

Me dice que descomente esta linea ???

// cSql := FW_AdoCreateTableSQL( cTableName, aWAData[ WA_SQLSTRUCT ], oConnection, .T. )
// oConnection:Execute( cSql )

¿ Pero esto depende de Fivewin ?
Si es así, dejo las pruebas porque no tengo ese codigo o ¿ ese codigo es libre ?

Dejo el codigo sin dependencias de FW

Code: Select all

#include "adordd.ch"

REQUEST HB_GT_WVT_DEFAULT

function Main()

   local aArray := {}

   rddsetdefault( 'ADORDD' )   // Forzamos RDD por defecto de HARBOUR

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

  endif



   USE test2.mdb VIA "ADORDD" TABLE "table1" NEW

   browse()


   APPEND BLANK
   test2->First   := "HOMER si no Homer"
   test2->Last    := "Simpson"
   test2->Age     := 45

   APPEND BLANK
   test2->First   := "aaa Lara"
   test2->Last    := "Croft si no"
   test2->Age     := 32


   GO TOP

   browse()

//  XBROWSER FASTEDIT
   DbCloseAll()

return nil
Saludos Cordiales
Saludos
Rafa Carmona ( rafa.thefullARROBAgmail.com___quitalineas__)
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: ADO RDD xHarbour

Post by Enrico Maria Giordano »

Antonio,
AHF wrote:May be M Rao or Enrico can give us a hand?
I could help but I need a reduced and self-contained sample showing the problem.

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

Re: ADO RDD xHarbour

Post by AHF »

Antonio,

I cannot find the cause of this error:
argumentos <nenhuma>
descrição Workarea not in use
ficheiro <nenhuma>
genCode 35: EG_NOTABLE
operação ORDSETFOCUS
osCode (Não é erro do sistema operativo)
severity 2
subCode 2001
subSystem DBCMD
tries 0
Stack Calls
Procedimentos / Metodos (linha)
===============================
Chamado de TDMDICHILD:FECHAMDI(558)
Chamado de (b)ENCOMCLIENTES(207) //ACTIVATE WINDOW ... VALID owmdi1:FechaMdi(obrowse)
Chamado de TDMDICHILD:END(0)
Chamado de TDMDICHILD:SYSCOMMAND(0)
Chamado de TWINDOW:HANDLEEVENT(0)
Chamado de TDMDICHILD:HANDLEEVENT(0)
Chamado de _FWH(0)
Chamado de WINRUN(0)
Chamado de TMDIFRAME:ACTIVATE(0)
Chamado de MAIN(74)
The FechaMdi(obrowse) only closes tables nothing else.
When I close the table = oBrw:calias immediately error.
This code works many years ok with other rdds.

Do you have any idea what can cause this error?
Regards
Antonio H Ferreira
AHF
Posts: 837
Joined: Fri Feb 10, 2006 12:14 pm

Re: ADO RDD xHarbour

Post by AHF »

Enrico Maria Giordano wrote:Antonio,
AHF wrote:May be M Rao or Enrico can give us a hand?
I could help but I need a reduced and self-contained sample showing the problem.

EMG
Enrico,

A self contained code its difficult but the problem is:

In adordd accordingly with the index active the select is like this:

SELECT encclist.*,(NRFACTUR+codcliente+CODIGOPROD+ARMAZEM) as indexkey FROM encclist ORDER BY NRFACTUR,codcliente,codigoprod,armazem

Where the indexkey is NRFACTUR+codcliente+CODIGOPROD+ARMAZEM.

From this recordset we cannot call oRecordSet:AddNew() it gives error.

If we use instead a recordset ike:

SELECT encclist.* FROM encclist ORDER BY NRFACTUR,codcliente,codigoprod,armazem

There inst any problem.

It will be impossible to add rows to the first recordset because of the aliase column?
Regards
Antonio H Ferreira
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: ADO RDD xHarbour

Post by Enrico Maria Giordano »

Antonio,
AHF wrote:It will be impossible to add rows to the first recordset because of the aliase column?
No, not for the aliased column but for the calculated column.

EMG
Post Reply