FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour ADO RDD xHarbour
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
Re: ADO RDD xHarbour
Posted: Sat May 23, 2015 08:54 AM
Lucas,

Mailed you last version.

cCondicion := "Dtoc( FIELD->FECHA ) >= " + chr( 34 ) + Dtoc( dFecha1 ) + chr( 34 ) + ;
" .AND. Dtoc( FIELD->FECHA ) <= " + chr( 34 ) + Dtoc( dFecha2 ) + chr( 34 )



SET FILTER TO alltrim( AUXILIAR->RELACION ) == alltrim( STR( oData:Codigo ))


cCondicion := "CONTA->CONCEPTO = " + chr( 34 ) + alltrim( cValToChar( cCuentaoConcepto ) ) + chr( 34 )


These should be ok since the are simply cleaned from expression because they are only conversion functions.

But when we use "extraction" functions like month etc I cant see how it can works because they are out of scope in :filter.
Regards

Antonio H Ferreira
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
Re: ADO RDD xHarbour
Posted: Sat May 23, 2015 09:01 AM
Lucas,

No, the replace is as follows:

REPLACE FIELD->FECHA WITH Date().


Here with MySql it works so must be a configuration issue.

Here fielddate is:
FIELDDATE DATE NULL DEFAULT NULL;
All other options empty
Regards

Antonio H Ferreira
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
Re: ADO RDD xHarbour
Posted: Sat May 23, 2015 09:10 AM

Lucas,

Your MySql innoDB ?

Regards

Antonio H Ferreira
Posts: 1303
Joined: Tue Jul 21, 2009 08:12 AM
Re: ADO RDD xHarbour
Posted: Sat May 23, 2015 09:10 AM
Antonio,

With the version you just send me, there are some bugs so far:

At, ADOFINDREC(), oRecordSet:AbsolutePosition := IF( oRS:AbsolutePosition == adPosEOF, oRS:RecordCount() + 1, oRS:AbsolutePosition ) is failing, as IF( oRS:AbsolutePosition == adPosEOF, oRS:RecordCount() + 1, oRS:AbsolutePosition ) its giving -1, which is not possible.

HBRECNO is not created by default. Also, the code at ADO_OPEN is not being proccessed to add it.

I suggested to simple add it to ADOCREATE(), which is the easiest way as explained before.

Also, to help debugging, please at AdoShowError, add procname(2) to 7:



Code (fw): Select all Collapse
FUNCTION ADOSHOWERROR( oCn, lSilent )

聽 聽LOCAL nErr, oErr, cErr

聽 聽DEFAULT oCn TO oConnection
聽 聽DEFAULT lSilent TO .F.

聽 聽IF ( nErr := oCn:Errors:Count ) > 0
聽 聽 聽 oErr 聽:= oCn:Errors( nErr - 1 )
聽 聽 聽 IF ! lSilent
聽 聽 聽 聽 聽WITH OBJECT oErr
聽 聽 聽 聽 聽 聽 cErr 聽 聽 := oErr:Description
聽 聽 聽 聽 聽 聽 cErr 聽 聽 += CRLF + 'Source 聽 聽 聽 : ' + oErr:Source
聽 聽 聽 聽 聽 聽 cErr 聽 聽 += CRLF + 'NativeError 聽: ' + cValToChar( oErr:NativeError )
聽 聽 聽 聽 聽 聽 cErr 聽 聽 += CRLF + 'Error Source : ' + oErr:Source
聽 聽 聽 聽 聽 聽 cErr 聽 聽 += CRLF + 'Sql State 聽 聽: ' + oErr:SQLState
聽 聽 聽 聽 聽 聽 cErr 聽 聽 += CRLF + REPLICATE( '-', 50 )
聽 聽 聽 聽 聽 聽 cErr 聽 聽 += CRLF + PROCNAME( 1 ) + "( " + cValToChar( PROCLINE( 1 ) ) + " )"
聽 聽 聽 聽 聽 聽 cErr 聽 聽 += CRLF + PROCNAME( 2 ) + "( " + cValToChar( PROCLINE( 2 ) ) + " )"
聽 聽 聽 聽 聽 聽 cErr 聽 聽 += CRLF + PROCNAME( 3 ) + "( " + cValToChar( PROCLINE( 3 ) ) + " )"
聽 聽 聽 聽 聽 聽 cErr 聽 聽 += CRLF + PROCNAME( 4 ) + "( " + cValToChar( PROCLINE( 4 ) ) + " )"
聽 聽 聽 聽 聽 聽 cErr 聽 聽 += CRLF + PROCNAME( 5 ) + "( " + cValToChar( PROCLINE( 5 ) ) + " )"
聽 聽 聽 聽 聽 聽 cErr 聽 聽 += CRLF + PROCNAME( 6 ) + "( " + cValToChar( PROCLINE( 6 ) ) + " )"
聽 聽 聽 聽 聽 聽 cErr 聽 聽 += CRLF + PROCNAME( 7 ) + "( " + cValToChar( PROCLINE( 7 ) ) + " )"
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.
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
Re: ADO RDD xHarbour
Posted: Sat May 23, 2015 09:27 AM
Lucas,


Antonio,

With the version you just send me, there are some bugs so far:

At, ADOFINDREC(), oRecordSet:AbsolutePosition := IF( oRS:AbsolutePosition == adPosEOF, oRS:RecordCount() + 1, oRS:AbsolutePosition ) is failing, as IF( oRS:AbsolutePosition == adPosEOF, oRS:RecordCount() + 1, oRS:AbsolutePosition ) its giving -1, which is not possible.

HBRECNO is not created by default. Also, the code at ADO_OPEN is not being proccessed to add it.

I suggested to simple add it to ADOCREATE(), which is the easiest way as explained before.

Also, to help debugging, please at AdoShowError, add procname(2) to 7:



HBRECNO or equivalent is missing. Im going to take out that code and it simply errors stating missing field...

AbsolutePosition Positionenum

Constant
Value
Description
adPosBOF
-2
Indicates that the current record pointer is at BOF (that is, the BOF property is True).
adPosEOF
-3
Indicates that the current record pointer is at EOF (that is, the EOF property is True).
adPosUnknown
-1
Indicates that the Recordset is empty, the current position is unknown, or the provider does not support the AbsolutePage or AbsolutePosition property.


Please also check your MySql ODBC driver params.

ADD COLUMN I need to have it in ADO_OPEN. Our client upload the tables with copy to and tehn he expects when opening it to have the field created.
Ill put it also in ADO_CREATE
Regards

Antonio H Ferreira
Posts: 1303
Joined: Tue Jul 21, 2009 08:12 AM
Re: ADO RDD xHarbour
Posted: Sat May 23, 2015 09:36 AM

Antonio,

With my previous code for HBRECNO, ADOFINDREC() does not fail.

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.
Posts: 1303
Joined: Tue Jul 21, 2009 08:12 AM
Re: ADO RDD xHarbour
Posted: Sat May 23, 2015 09:44 AM
Antonio,

DbAppend(, ADO_APPEND(), fails with dates here:

Code (fw): Select all Collapse
            AADD( aVals, HB_DECODE( aStruct[ n, 2 ], 'C', Space( aStruct[ n, 3 ] ), 'D', CToD( '' ), 'L', .f., ;
                 'M', "", 'm', "", '+', 0, ;
                 'N', If( aStruct[ n, 3 ] == 0, 0, Val( "0." + Replicate( '0', aStruct[ n, 3 ] ) ) ), ;
                 'T', CTOT( '' ), '' ) )


It does not support an empty CTDOD().
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.
Posts: 1303
Joined: Tue Jul 21, 2009 08:12 AM
Re: ADO RDD xHarbour
Posted: Sat May 23, 2015 10:17 AM
Antonio,

I asked about empty dates at append blank.

Also, SET FILTER does not suport values, i.e:

Code (fw): Select all Collapse
SET FILTER TO LUCAS->NAME == cName


Thank you.

Seems less to finish ADORDD.
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.
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
Re: ADO RDD xHarbour
Posted: Sat May 23, 2015 10:25 AM
Lucas,

It does not support an empty CTDOD().


How can it work here like that? adordd its prepared to consider 31/12/1899 as empty date.
We place 31/12/1899?

With my previous code for HBRECNO, ADOFINDREC() does not fail.


Table is the same ? Here that version its working.

There must be something wrong with your config. Here all its working.

ADO_OPEN it inserts field set to be used as recno as first field primary key.

Do you have SET ADO DEFAULT RECNO FIELD TO .. defined?
Regards

Antonio H Ferreira
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
Re: ADO RDD xHarbour
Posted: Sat May 23, 2015 10:36 AM
Lucas,

I asked about empty dates at append blank.


Please explain.

Also, SET FILTER does not suport values, i.e:

Code:

SET FILTER TO LUCAS->NAME == cName



Thats what I was speaking about. All vars must be evaluated before sent to ado filter once they are out of scope there.
In order to be 100 % compatible with standard syntax we must evaluate the filter condition ourselves and build a "faik" recordset.

Again please check your config because here all your mentioned points are working.
Regards

Antonio H Ferreira
Posts: 1303
Joined: Tue Jul 21, 2009 08:12 AM
Re: ADO RDD xHarbour
Posted: Sat May 23, 2015 10:50 AM

Antonio,

About filtering, is not possible at SqlTranslate() to evalutate cName, so as to get its value and build the filter?.

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.
Posts: 1303
Joined: Tue Jul 21, 2009 08:12 AM
Re: ADO RDD xHarbour
Posted: Sat May 23, 2015 10:54 AM
Antonio,

At ADOAPPEND(), and using Mr. Nages advice, this is the proper fix:

Code (fw): Select all Collapse
            AADD( aVals, HB_DECODE( aStruct[ n, 2 ], 'C', Space( aStruct[ n, 3 ] ), 'D', AdoNull(), 'L', .f., ;
                 'M', "", 'm', "", '+', 0, ;
                 'N', If( aStruct[ n, 3 ] == 0, 0, Val( "0." + Replicate( '0', aStruct[ n, 3 ] ) ) ), ;
                 'T', AdoNull(), '' ) )
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.
Posts: 1303
Joined: Tue Jul 21, 2009 08:12 AM
Re: ADO RDD xHarbour
Posted: Sat May 23, 2015 12:19 PM
Antonio,

I get this error:



[0x80040E38][Microsoft Cursor Engine] Row cannot be located for updating. Some values may have been changed since it was last read

Error description: (DOS Error -2147352567) WINOLE/1007 No se puede encontrar la fila para su actualizaci贸n: algunos valores han cambiado desde la 煤ltima vez que se ley贸. (0x80040E38): Microsoft Cursor Engine

Stack Calls
===========
Called from: => TOLEAUTO:UPDATE( 0 )
Called from: source\adordd.prg => ADO_PUTVALUE( 1503 )




ADO_PUTVALUE( 1503 ) -> oRecordSet:Update()

oRecordSet:Fields( nField - 1 ):Value := xValue
oRecordSet:Update()


This is my code:

REPLACE FACTURAS->NOMBRE WITH CLIENTES->NOMBRE
.... and so one


The real cause:

Field lengh for FACTURAS nombre is 34, but in CLIENTES is 50.
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.
Posts: 1303
Joined: Tue Jul 21, 2009 08:12 AM
Re: ADO RDD xHarbour
Posted: Sat May 23, 2015 12:24 PM

But current NAME is LUCAS DE BELTRAN, not 50 or 34 chars.

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.
Posts: 838
Joined: Fri Feb 10, 2006 12:14 PM
Re: ADO RDD xHarbour
Posted: Sat May 23, 2015 08:06 PM
Lucas,


DO_PUTVALUE( 1503 ) -> oRecordSet:Update()

oRecordSet:Fields( nField - 1 ):Value := xValue
oRecordSet:Update()


This is my code:

REPLACE FACTURAS->NOMBRE WITH CLIENTES->NOMBRE
.... and so one


The real cause:

Field lengh for FACTURAS nombre is 34, but in CLIENTES is 50.


This works here.
adordd automatically truncates :

C values to the len of the field
N values decimals round to the number of decimals in the field left part of the number it throws a error data_with.

Did you try this after copy to to build this table?
Your addition on ado_append to insert field recno cant be used because with "copy to" all fields will be out of order between the source table and destination table
We must use aadd() field.

Field dates in "copy to" when the source table was opened via ex"dbfcdx" continues to error.

Filters we will need some help because I dont have now the time to worry to much about it as I dont need it for this project.
Ill try to do the best I can.
Regards

Antonio H Ferreira