Page 40 of 70

Re: ADO RDD xHarbour

PostPosted: Wed May 20, 2015 7:42 am
by AHF
Lucas,

oRecordSet:Update( nField - 1, IfNil( xValue, AdoNull() ) )


Im going to try it.
The date errors only happens (MySql) when you edit a empty date and save the same empty date.
Thats why we didnt have found it before although the app makes lot of transactions but never in this circumstance.
When the user in a browse does that errors.

I know that expressions with numbers in SCOPES and perhaps INDEX mail fail. Fortunatly we dont have such cases in the app. Ill give it a look asap.
The app we are working doesnt have SCOPES so its done but never tried.
Can you post an example based on your trial tables?

Our client wants the filters as they have with ADS. They are lightning fast thus we have to do it that way.
Filters we will convert it for now to Mysql expressions only.

About record size we dont have the error here. We have tables with more than 60 fields.
Ive try it already with Mysql and Access.
What is the record size causing your problem?

Re: ADO RDD xHarbour

PostPosted: Wed May 20, 2015 8:08 am
by lucasdebeltran
Antonio,

What is your email to send the database?.

The database has some fields with 80 or more chars.

About scopes, try to do

SET SCOPE TO ID = 10

Re: ADO RDD xHarbour

PostPosted: Wed May 20, 2015 8:20 am
by AHF
Lucas,

I tried your code last post.
Result is the same if I edit a field date in browse() with an empty date and make enter with empty date errors.
If I do the same but enter a date ok
If I do the same and clean that date ok

disal.antonio.ferreira at gmail.com

Ill try scopes asap

Re: ADO RDD xHarbour

PostPosted: Wed May 20, 2015 8:24 am
by AHF
Lucas,

The database has some fields with 80 or more chars.


Ours some fields with 200 chars.

Can you check exact recsize()

Re: ADO RDD xHarbour

PostPosted: Wed May 20, 2015 8:31 am
by lucasdebeltran
Yes, returns 6763.

Thanks.

Re: ADO RDD xHarbour

PostPosted: Wed May 20, 2015 8:50 am
by AHF
Lucas,

Thanks Ill try it.

About dates the only way it works with access and mysql is placing in ADO_PUTVALUE :

Code: Select all  Expand view

IF ADO_FIELDSTRUCT( oRecordSet, nField-1 )[2] $ "DT" .AND. (EMPTY(xValue) .OR. FW_TTOD( xValue ) == {^ 1899/12/30 })

   xValue := 0

ENDIF
 



But Ill get back to the problem that the date field stays with 31/12/1899.
SQL dates support dates from 01/01/1900 on maybe thats why blank dates are 31.12.1899 23:59:59

Im trying in ADO_GETVALUE() to return a empty date in this condition otherwise this doesnt work for me.

Can you try it there and confirm?

Re: ADO RDD xHarbour

PostPosted: Wed May 20, 2015 10:53 am
by AHF
Lucas,

I think dates problem its solved. (Access Mysql oledb ADS)

Ive found out that when the field date is empty the fields:value type its "U" and can not be accessed in this state.
When we entered a field date empty and issue update with nothing it errors saying MEMBERNOTFOUND

Ill end you new version during today.

Re: ADO RDD xHarbour

PostPosted: Wed May 20, 2015 11:11 am
by lucasdebeltran
Antonio,

SET SCOPE fix seems to be:

STATIC FUNCTION ADOSCOPE(nWA,aWAdata, oRecordSet, aOrderInfo,nIndex)

IF LEN(ALLTRIM( cvaltochar(aWAData[ WA_SCOPETOP ][y]) + cvaltochar(aWAData[ WA_SCOPEBOT ][y])) ) > 0

Scopetop and ScopeBot can be a numeric.


Fields names greater that 8 chars fail.


Also, in DbCreate() I will add the following feature. In ADOSTRUCTTOSQL( aWAData,aStruct ,lAddAutoInc) I will check if aStruct has the default ID Autoincrement field, usually called HBRECNO. If there is no autoincrement "+" field, I will add to the array:

aAdd( aStruct, { "HBRECNO", "+", 15, 0 } )


Thanks.

Re: ADO RDD xHarbour

PostPosted: Wed May 20, 2015 11:24 am
by AHF
Lucas,

Im looking at SET SCOPE and SET FILTER.

Fields names greater that 8 chars fail.


Where at scopes? Filedname() returns the :field:name

Can you try fieldname() function?

Re: ADO RDD xHarbour

PostPosted: Wed May 20, 2015 11:26 am
by AHF
Lucas,

Also, in DbCreate() I will add the following feature. In ADOSTRUCTTOSQL( aWAData,aStruct ,lAddAutoInc) I will check if aStruct has the default ID Autoincrement field, usually called HBRECNO. If there is no autoincrement "+" field, I will add to the array:

aAdd( aStruct, { "HBRECNO", "+", 15, 0 }


Good idea! Please post your change here.

Re: ADO RDD xHarbour

PostPosted: Wed May 20, 2015 11:32 am
by lucasdebeltran
Antonio,

Code: Select all  Expand view


STATIC FUNCTION ADOSTRUCTTOSQL( aWAData,aStruct ,lAddAutoInc)

 LOCAL cSql := "", nCol
 LOCAL oCn := aWAData[ WA_CONNECTION ]
 LOCAL dbEngine := aWAData[ WA_ENGINE ], nver :=0
 LOCAL aEngines := { "DBASE","ACCESS","MSSQL","MYSQL","ORACLE","SQLITE",;
                     "FOXPRO","POSTGRE","INFORMIX","ANYWHERE","ADS"}
 LOCAL snDbms := ASCAN(aEngines,dbEngine),c


 if AScan( aStruct , "HBRECNO" )  = 0
    aAdd( aStruct, { "HBRECNO", "+",  15,   0 } )
 endif



 

Re: ADO RDD xHarbour

PostPosted: Wed May 20, 2015 11:50 am
by AHF
Lucas,

Thanks.

About fieldname we are limited to 10 chars long not 8
This its (x)Harbour limitation. adordd simply returns :field:name but then usrrdd cuts it to 10 chars long.

For us no problem is it for you? Although this is a huge limitation in SQL.

We need Antonio to help us solve this limitation.

Re: ADO RDD xHarbour

PostPosted: Wed May 20, 2015 1:19 pm
by lucasdebeltran
Antonio,

aWAData[ WA_SCOPETOP ][y] and aWAData[ WA_SCOPEBOT ][y] seems that are SCOPE´s values.

You are issuing LEN(ALLTRIM( ..., but those Scope values could be a number, or a date, so that´s why it fails.

Re: ADO RDD xHarbour

PostPosted: Wed May 20, 2015 1:47 pm
by AHF
Lucas,

We can use

Code: Select all  Expand view
IF !EMPTY(aWAData[ WA_SCOPETOP ][y]) .OR. !EMPTY(aWAData[ WA_SCOPEBOT ][y])


Can you try it?

Re: ADO RDD xHarbour

PostPosted: Wed May 20, 2015 1:56 pm
by AHF
Lucas,

There another bug in adoscope.

Please replace with this code: (note the 2 commented aadd)

Code: Select all  Expand view

 CASE nIndex == DBOI_SCOPETOP

        IF y > 0
           aOrderInfo[ UR_ORI_RESULT ] := aWAData[ WA_SCOPETOP ][y] //RETURN ACTUALSCOPE TOP
           aWAData[ WA_SCOPETOP ][y] := aOrderInfo[ UR_ORI_NEWVAL ]
           IF LEN(aWAData[ WA_SCOPEBOT ]) < y
              AADD(aWAData[ WA_SCOPEBOT ],SPACE(LEN(CVALTOCHAR(aWAData[ WA_SCOPETOP ][y])))) //THERE INST STILL A SCOPEBOT ARRAYS MUST HAVE  SAME LEN
           ENDIF     
        ELSE
           AADD(aWAData[ WA_SCOPETOP ],aOrderInfo[ UR_ORI_NEWVAL ])
           //AADD(aWAData[ WA_SCOPEBOT ],SPACE(LEN(CVALTOCHAR(aWAData[ WA_SCOPETOP ][1])))) //THERE INST STILL A SCOPEBOT ARRAYS MUST HAVE  SAME LEN
           aOrderInfo[ UR_ORI_RESULT ] := ""
        ENDIF      
     
   CASE nIndex == DBOI_SCOPEBOTTOM

        IF y > 0
           aOrderInfo[ UR_ORI_RESULT ] := aWAData[ WA_SCOPEBOT ][y] //RETURN ACTUALSCOPE TOP
           aWAData[ WA_SCOPEBOT ][y] := aOrderInfo[ UR_ORI_NEWVAL ]
           IF LEN(aWAData[ WA_SCOPETOP ]) < y
              AADD(aWAData[ WA_SCOPETOP ],SPACE(LEN(CVALTOCHAR(aWAData[ WA_SCOPEBOT ][y])))) //THERE INST STILL A SCOPETOP ARRAYS MUST HAVE  SAME LEN
           ENDIF     
        ELSE
           AADD( aWAData[ WA_SCOPES ],aWAData[ WA_INDEXACTIVE ])
           AADD(aWAData[ WA_SCOPEBOT ],aOrderInfo[ UR_ORI_NEWVAL ])
           //AADD(aWAData[ WA_SCOPETOP ],SPACE(LEN(CVALTOCHAR(aWAData[ WA_SCOPEBOT ][1])))) //THERE INST STILL A SCOPETOP ARRAYS MUST HAVE  SAME LEN
           aOrderInfo[ UR_ORI_RESULT ] := ""
        ENDIF