Page 23 of 70

Re: ADO RDD xHarbour

PostPosted: Tue Apr 07, 2015 3:19 pm
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.

Re: ADO RDD xHarbour

PostPosted: Tue Apr 07, 2015 3:33 pm
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

Re: ADO RDD xHarbour

PostPosted: Tue Apr 07, 2015 3:44 pm
by thefull
Please,

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

Regards.

Re: ADO RDD xHarbour

PostPosted: Tue Apr 07, 2015 3:59 pm
by lucasdebeltran
Rafa,

Code: Select all  Expand view


#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

 



Re: ADO RDD xHarbour

PostPosted: Tue Apr 07, 2015 4:08 pm
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?

Re: ADO RDD xHarbour

PostPosted: Tue Apr 07, 2015 4:14 pm
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.

Re: ADO RDD xHarbour

PostPosted: Tue Apr 07, 2015 4:33 pm
by Antonio Linares
Having as many people as possible trying will help to solve all the issues more rapidly


+1

Re: ADO RDD xHarbour

PostPosted: Wed Apr 08, 2015 9:23 am
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.

Re: ADO RDD xHarbour

PostPosted: Wed Apr 08, 2015 9:39 am
by Antonio Linares
Antonio,

I have emailed Mr. Rao asking for his advice

Re: ADO RDD xHarbour

PostPosted: Wed Apr 08, 2015 2:03 pm
by thefull
Buenas, seria bueno quitar todo referente a Fivewin, para que sea más fácil compilar.
Por ejemplo,

Code: Select all  Expand view
#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  Expand view
       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  Expand view
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  Expand view
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

Re: ADO RDD xHarbour

PostPosted: Wed Apr 08, 2015 2:14 pm
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  Expand view
#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

Re: ADO RDD xHarbour

PostPosted: Wed Apr 08, 2015 2:32 pm
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

Re: ADO RDD xHarbour

PostPosted: Wed Apr 08, 2015 2:35 pm
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?

Re: ADO RDD xHarbour

PostPosted: Wed Apr 08, 2015 2:44 pm
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?

Re: ADO RDD xHarbour

PostPosted: Wed Apr 08, 2015 2:50 pm
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