AHF wrote:Antonio,
What is this for ?
HB_SYMBOL_UNUSED( nWA )
STATIC FUNCTION ADO_FIELDSTRUCT( oRs, n ) // ( oRs, nFld ) where nFld is 1 based
// ( oRs, oField ) or ( oRs, cFldName )
// ( oField )
LOCAL oField, nType, uval
LOCAL cType := 'C', nLen := 10, nDec := 0, lRW := .t.,nDBFFieldType := HB_FT_STRING // default
LOCAL nFWAdoMemoSizeThreshold := 1024
/*
cType DBF TYPE "C","N","D" ETC
nDBFFieldType HB_FT_STRING ETC
*/
/* IF n == nil
oField := oRs
oRs := nil
ELSEIF VALTYPE( n ) == 'O'
oField := n
ELSE
IF ValType( n ) == 'N'
n--
ENDIF
TRY
oField := oRs:Fields( n )
CATCH
END
ENDIF
IF oField == nil
RETURN nil
ENDIF
*/
oField := oRs:Fields( n )
nType := oField:Type
IF nType == adBoolean
cType := 'L'
nLen := 1
nDBFFieldType := HB_FT_LOGICAL
ELSEIF ASCAN( { adDate, adDBDate, adDBTime, adDBTimeStamp }, nType ) > 0
cType := 'D'
nLen := 8
IF oRs != nil .AND. ! oRs:Eof() .AND. VALTYPE( uVal := oField:Value ) == 'T'
//.AND. FW_TIMEPART( uVal ) >= 1.0 WHERE IS THIS FUNCTION?
cType := '@' //'T'
nLen := oField:DefinedSize
nDBFFieldType := HB_FT_TIMESTAMP // DONT KNWO IF IT IS CORRECT!
ELSE
nDBFFieldType := HB_FT_DATE
ENDIF
ELSEIF ASCAN( { adTinyInt, adSmallInt, adInteger, adBigInt, ;
adUnsignedTinyInt, adUnsignedSmallInt, adUnsignedInt, ;
adUnsignedBigInt }, nType ) > 0
cType := 'N'
nLen := oField:Precision + 1 // added 1 for - symbol
IF oField:Properties( "ISAUTOINCREMENT" ):Value == .t.
cType := '+'
lRW := .f.
ENDIF
nDBFFieldType := HB_FT_INTEGER
ELSEIF ASCAN( { adSingle, adDouble, adCurrency }, nType ) > 0
cType := 'N' //SHOULDNT BE "B"?
nLen := MIN( 19, oField:Precision-oField:NumericScale-1 ) //+ 2 )
IF oField:NumericScale > 0 .AND. oField:NumericScale < nLen
nDec := oField:NumericScale
ENDIF
nDBFFieldType := HB_FT_INTEGER //HB_FT_DOUBLE WICH ONE IS CORRECT?
ELSEIF ASCAN( { adDecimal, adNumeric, adVarNumeric }, nType ) > 0
cType := 'N'
nLen := Min( 19, oField:Precision-oField:NumericScale-1 ) //+ 2 )
IF oField:NumericScale > 0 .AND. oField:NumericScale < nLen
nDec := oField:NumericScale
ENDIF
nDBFFieldType := HB_FT_INTEGER //HB_FT_LONG WICH ONE IS CORRECT?
ELSEIF ASCAN( { adBSTR, adChar, adVarChar, adLongVarChar, adWChar, adVarWChar, adLongVarWChar }, nType ) > 0
nLen := oField:DefinedSize
nDBFFieldType := HB_FT_STRING
IF nType != adChar .AND. nType != adWChar .AND. nLen > nFWAdoMemoSizeThreshold
cType := 'M'
nLen := 10
nDBFFieldType := HB_FT_MEMO
ENDIF
ELSEIF ASCAN( { adBinary, adVarBinary, adLongVarBinary }, nType ) > 0
cType := "G"
nLen := oField:DefinedSize
IF nType != adBinary .AND. nLen > nFWAdoMemoSizeThreshold
cType := 'M'
nLen := 10
ENDIF
nDBFFieldType := HB_FT_OLE
IF nType != adBinary .AND. nLen > nFWAdoMemoSizeThreshold
nDBFFieldType := HB_FT_MEMO
ENDIF
ELSEIF ASCAN( { adChapter, adPropVariant}, nType ) > 0
cType := 'O'
lRW := .f.
nDBFFieldType := HB_FT_MEMO
ELSEIF ASCAN( { adVariant, adIUnknown }, nType ) > 0
cType := "V"
nDBFFieldType := HB_FT_ANY
ELSEIF ASCAN( { adGUID }, nType ) > 0
nDBFFieldType := HB_FT_STRING
ELSEIF ASCAN( { adFileTime }, nType ) > 0
cType := "T"
nDBFFieldType := HB_FT_DATETIME
ELSEIF ASCAN( { adEmpty, adError, adUserDefined, adIDispatch }, nType ) > 0
cType = 'O'
lRw := .t.
nDBFFieldType := HB_FT_NONE //what is this? maybe NONE is wrong!
ELSE
lRW := .f.
ENDIF
IF lAnd( oField:Attributes, 0x72100 ) .OR. ! lAnd( oField:Attributes, 8 )
lRW := .f.
ENDIF
RETURN { oField:Name, cType, nLen, nDec, nType, lRW, nDBFFieldType }
AHF wrote:Do you code code use index present in the server DB with ADOX? Maybe Enrico has it.
AHF wrote:I know I shouldnt use ADOX!
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: betoncu, Google [Bot] and 83 guests