Page 3 of 70
Re: ADO RDD xHarbour
Posted: Tue Mar 10, 2015 10:04 am
by AHF
Antonio,
Continue to get error UR_SUPER_ADDFIELD(0) EG_ARG 1003 SUBSSYSTEM ADORDD
May be I have a wrong version of UR_SUPER_ADDFIELD
What are the expected parameters of this function?
Also the THREAD STATIC does not compile I have to take THREAD out.
I dont have function hb_ntos, hb_stod
Without "common.ch" HB_SYMBOL_UNUSED does not compile.
Re: ADO RDD xHarbour
Posted: Tue Mar 10, 2015 10:49 am
by Antonio Linares
In
https://github.com/harbour/core/blob/master/src/rdd/usrrdd/rdds/arrayrdd.prg UR_SUPER_ADDFIELD() is used this way:
Code: Select all | Expand
FOR EACH aFieldStruct IN aStruct
aField := Array( UR_FI_SIZE )
aField[ UR_FI_NAME ] := aFieldStruct[ DBS_NAME ]
aField[ UR_FI_TYPE ] := hb_Decode( aFieldStruct[ DBS_TYPE ], "C", HB_FT_STRING, "L", HB_FT_LOGICAL, "M", HB_FT_MEMO, "D", HB_FT_DATE, "N", iif( aFieldStruct[ DBS_DEC ] > 0, HB_FT_DOUBLE, HB_FT_INTEGER ) )
aField[ UR_FI_TYPEEXT ] := 0
aField[ UR_FI_LEN ] := aFieldStruct[ DBS_LEN ]
aField[ UR_FI_DEC ] := aFieldStruct[ DBS_DEC ]
UR_SUPER_ADDFIELD( nWA, aField )
NEXT
nWA seems to be the workarea number and aField is an array with those values.
Re: ADO RDD xHarbour
Posted: Tue Mar 10, 2015 10:54 am
by Antonio Linares
I dont have function hb_ntos, hb_stod
Those functions are from harbour standard libraries.
How do you get this error ?
Re: ADO RDD xHarbour
Posted: Tue Mar 10, 2015 11:54 am
by AHF
Antonio,
Im working with FWH October 2008 and xHarbour Sept 2008 .
Is this the reason?
Re: ADO RDD xHarbour
Posted: Tue Mar 10, 2015 12:10 pm
by AHF
Antonio,
As far as I understand I must send in aField[ UR_FI_TYPE ] with clipper standard field types C N L...
But I still get te same error
Re: ADO RDD xHarbour
Posted: Tue Mar 10, 2015 12:29 pm
by Antonio Linares
Please post here the code that you are using when you fill aField and call the function
Re: ADO RDD xHarbour
Posted: Tue Mar 10, 2015 1:18 pm
by AHF
Here it is
[code]FOR n := 1 TO nTotalFields
aField := Array( UR_FI_SIZE )
aField[ UR_FI_NAME ] := oRecordSet:Fields( n - 1 ):Name
ADO_FIELDINFO( nWA, n, DBS_TYPE, @uInfo )
aField[ UR_FI_TYPE ] := uInfo
aField[ UR_FI_TYPEEXT ] := 0
ADO_FIELDINFO( nWA, n, DBS_LEN, @uInfo )
aField[ UR_FI_LEN ] := uInfo
ADO_FIELDINFO( nWA, n, DBS_DEC, @uInfo )
aField[ UR_FI_DEC ] := uInfo
/*
#ifdef UR_FI_FLAGS
aField[ UR_FI_FLAGS ] := 0
#endif
#ifdef UR_FI_STEP
aField[ UR_FI_STEP ] := 0
#endif
*/
MsgInfo( "name "+aField[ UR_FI_NAME ] +" Type "+ aField[ UR_FI_TYPE ] +" len "+str(aField[ UR_FI_LEN ])+" decimals "+str(aField[ UR_FI_DEC ] ) )
UR_SUPER_ADDFIELD( nWA, aField )
NEXT
STATIC FUNCTION ADO_FIELDINFO( nWA, nField, nInfoType, uInfo )
LOCAL nType, nLen
LOCAL oRecordSet := USRRDD_AREADATA( nWA )[ WA_RECORDSET ]
DO CASE
CASE nInfoType == DBS_NAME
uInfo := oRecordSet:Fields( nField - 1 ):Name
CASE nInfoType == DBS_TYPE
nType := ADO_GETFIELDTYPE( oRecordSet:Fields( nField - 1 ):Type )
DO CASE
CASE nType == HB_FT_STRING
uInfo := "C"
CASE nType == HB_FT_LOGICAL
uInfo := "L"
CASE nType == HB_FT_MEMO
uInfo := "M"
CASE nType == HB_FT_OLE
uInfo := "G"
#ifdef HB_FT_PICTURE
CASE nType == HB_FT_PICTURE
uInfo := "P"
#endif
CASE nType == HB_FT_ANY
uInfo := "V"
CASE nType == HB_FT_DATE
uInfo := "D"
#ifdef HB_FT_DATETIME
CASE nType == HB_FT_DATETIME
uInfo := "T"
#endif
CASE nType == HB_FT_TIMESTAMP
uInfo := "@"
CASE nType == HB_FT_LONG
uInfo := "N"
CASE nType == HB_FT_INTEGER
uInfo := "I"
CASE nType == HB_FT_DOUBLE
uInfo := "B"
OTHERWISE
uInfo := "U"
ENDCASE
CASE nInfoType == DBS_LEN
ADO_FIELDINFO( nWA, nField, DBS_TYPE, @nType )
IF nType == "N"
nLen := oRecordSet:Fields( nField - 1 ):Precision
ELSE
nLen := ADO_GETFIELDSIZE( ADO_GETFIELDTYPE( oRecordSet:Fields( nField - 1 ):Type ), oRecordSet:Fields( nField - 1 ):DefinedSize )
ENDIF
/* Un campo mayor de 1024 lo consideramos un campo memo */
uInfo := iif( nLen > 1024, 10, nLen )
CASE nInfoType == DBS_DEC
ADO_FIELDINFO( nWA, nField, DBS_LEN, @nLen )
ADO_FIELDINFO( nWA, nField, DBS_TYPE, @nType )
IF oRecordSet:Fields( nField - 1 ):Type == adInteger
uInfo := 0
ELSEIF nType == "N"
//uInfo := Min( Max( 0, nLen - 1 - oRecordSet:Fields( nField - 1 ):DefinedSize ), 15 )
uInfo := oRecordSet:Fields( nField - 1 ):NumericScale
ELSE
uInfo := 0
ENDIF
#ifdef DBS_FLAG
CASE nInfoType == DBS_FLAG
uInfo := 0
#endif
#ifdef DBS_STEP
CASE nInfoType == DBS_STEP
uInfo := 0
#endif
OTHERWISE
RETURN HB_FAILURE
ENDCASE
RETURN HB_SUCCESS
/[code]
Re: ADO RDD xHarbour
Posted: Tue Mar 10, 2015 1:22 pm
by AHF
Code: Select all | Expand
FOR n := 1 TO nTotalFields
aField := Array( UR_FI_SIZE )
aField[ UR_FI_NAME ] := oRecordSet:Fields( n - 1 ):Name
ADO_FIELDINFO( nWA, n, DBS_TYPE, @uInfo )
aField[ UR_FI_TYPE ] := uInfo
aField[ UR_FI_TYPEEXT ] := 0
ADO_FIELDINFO( nWA, n, DBS_LEN, @uInfo )
aField[ UR_FI_LEN ] := uInfo
ADO_FIELDINFO( nWA, n, DBS_DEC, @uInfo )
aField[ UR_FI_DEC ] := uInfo
/*
#ifdef UR_FI_FLAGS
aField[ UR_FI_FLAGS ] := 0
#endif
#ifdef UR_FI_STEP
aField[ UR_FI_STEP ] := 0
#endif
*/
MsgInfo( "name "+aField[ UR_FI_NAME ] +" Type "+ aField[ UR_FI_TYPE ] +" len "+str(aField[ UR_FI_LEN ])+" decimals "+str(aField[ UR_FI_DEC ] ) )
UR_SUPER_ADDFIELD( nWA, aField )
NEXT
STATIC FUNCTION ADO_FIELDINFO( nWA, nField, nInfoType, uInfo )
LOCAL nType, nLen
LOCAL oRecordSet := USRRDD_AREADATA( nWA )[ WA_RECORDSET ]
DO CASE
CASE nInfoType == DBS_NAME
uInfo := oRecordSet:Fields( nField - 1 ):Name
CASE nInfoType == DBS_TYPE
nType := ADO_GETFIELDTYPE( oRecordSet:Fields( nField - 1 ):Type )
DO CASE
CASE nType == HB_FT_STRING
uInfo := "C"
CASE nType == HB_FT_LOGICAL
uInfo := "L"
CASE nType == HB_FT_MEMO
uInfo := "M"
CASE nType == HB_FT_OLE
uInfo := "G"
#ifdef HB_FT_PICTURE
CASE nType == HB_FT_PICTURE
uInfo := "P"
#endif
CASE nType == HB_FT_ANY
uInfo := "V"
CASE nType == HB_FT_DATE
uInfo := "D"
#ifdef HB_FT_DATETIME
CASE nType == HB_FT_DATETIME
uInfo := "T"
#endif
CASE nType == HB_FT_TIMESTAMP
uInfo := "@"
CASE nType == HB_FT_LONG
uInfo := "N"
CASE nType == HB_FT_INTEGER
uInfo := "I"
CASE nType == HB_FT_DOUBLE
uInfo := "B"
OTHERWISE
uInfo := "U"
ENDCASE
CASE nInfoType == DBS_LEN
ADO_FIELDINFO( nWA, nField, DBS_TYPE, @nType )
IF nType == "N"
nLen := oRecordSet:Fields( nField - 1 ):Precision
ELSE
nLen := [b]ADO_GETFIELDSIZE( ADO_GETFIELDTYPE( oRecordSet:Fields( nField - 1 ):Type ), oRecordSet:Fields( nField - 1 ):DefinedSize )[/b]
ENDIF
/* Un campo mayor de 1024 lo consideramos un campo memo */
uInfo := iif( nLen > 1024, 10, nLen )
CASE nInfoType == DBS_DEC
ADO_FIELDINFO( nWA, nField, DBS_LEN, @nLen )
ADO_FIELDINFO( nWA, nField, DBS_TYPE, @nType )
IF oRecordSet:Fields( nField - 1 ):Type == adInteger
uInfo := 0
ELSEIF nType == "N"
//uInfo := Min( Max( 0, nLen - 1 - oRecordSet:Fields( nField - 1 ):DefinedSize ), 15 )
uInfo := [b]oRecordSet:Fields( nField - 1 ):NumericScale[/b]
ELSE
uInfo := 0
ENDIF
#ifdef DBS_FLAG
CASE nInfoType == DBS_FLAG
uInfo := 0
#endif
#ifdef DBS_STEP
CASE nInfoType == DBS_STEP
uInfo := 0
#endif
OTHERWISE
RETURN HB_FAILURE
ENDCASE
RETURN HB_SUCCESS
Re: ADO RDD xHarbour
Posted: Tue Mar 10, 2015 4:44 pm
by lucasdebeltran
Hello Antonio,
If you post a full working sample it would be easier to look into the problem.
I tested ADORDD in the past and it worked nice, but indexes were not supported. Are thet now?.
Re: ADO RDD xHarbour
Posted: Tue Mar 10, 2015 5:55 pm
by AHF
Hello Lucas,
Im using the rddado.prg and .ch posted by Antonio in previous post.
I've proceed with the changes posted after because I always get an error .
I'm trying to work first with dbf files like this.
RddRegister("ADORDD",1)
RddSetDefault("ADORDD")
sele 0
use "whatever" shared
Browse()
I dont know if indexes work now. There is code for it but I still didnt tryed it.
It depends also on the provider.
Re: ADO RDD xHarbour
Posted: Wed Mar 11, 2015 8:23 am
by Antonio Linares
Antonio,
All that we can do here is to double check that we have properly filled aField before calling that function.
I doubt there is an error like this in the Harbour RDD engine, so I guess we are suplying wrong values to aField
If everything is ok, we may need to low level trace the RDD code to find the exact value that generates the error.
Re: ADO RDD xHarbour
Posted: Wed Mar 11, 2015 8:53 am
by AHF
Antonio,
I checked with msginfo() and the values in aField passed to UR_SUPER_ADDFIELD( nWA, aField ) are:
nWa = workarea number
aField[ UR_FI_NAME ] := "name of field"
aField[ UR_FI_TYPE ] := one of "C","L","D","N","M"
aField[ UR_FI_TYPEEXT ] := 0
aField[ UR_FI_LEN ] := length of the field as number
aField[ UR_FI_DEC ] := number of decimal places as number
aField array 5 elements
The first element shows:
nWA 20
NAME "NRENCOMEND"
TYPE "C"
LEN 10
DEC 0
TYPEEXT 0
and it generates the error.
In the original RDDADO the values were:
nWa 20
NAME "NRENCOMEND"
TYPE HB_FT_STRING
LEN 10
DEC 0
TYPEEXT 0
Same result.
Re: ADO RDD xHarbour
Posted: Wed Mar 11, 2015 9:20 am
by Antonio Linares
Re: ADO RDD xHarbour
Posted: Wed Mar 11, 2015 9:40 am
by AHF
Antonio,
Yes and I checked with :
msginfo(str(HB_Decode( aField[ DBS_TYPE ], "C", HB_FT_STRING, "L", HB_FT_LOGICAL, "M", HB_FT_MEMO, "D", HB_FT_DATE, "N", IIF( aField[ DBS_DEC ] > 0, HB_FT_DOUBLE, HB_FT_INTEGER ) )))
It returns HB_FT_STRING for "C" for example.
All other elements are straight foward.
The error 1003 its a variable not found.
Can this be due for some other reason?
Re: ADO RDD xHarbour
Posted: Wed Mar 11, 2015 11:12 am
by Antonio Linares
Antonio,
I guess you have to supply HB_FT_STRING instead of "C"