Antonio,
I already have seen some example of ADO in FiveWin and even use this function in some reports that I took the sources and adapted to my use:
I can deal with it better as I want the returns and evaluate the performace based on the mass amount of data it is used.
but then I ask you, regarding the performace or layers created for access, it would be possible, I wish to use with remote servers and the like, would be viable? (Ie with Mysql or MsSql for example)
Function SqlQuery( cSql, lRecordSet,lExecute, lCompact )
&& exemplo -> aresp:=SqlQuery([SELECT CODIPRO FROM PRODUTOS WHERE NOMEPRO LIKE '%B%'])
local uRet := {} // Retorno com Registros
local oRs, nAt , oCn // Objetos de controle para o ODBC e o Registro
Local cArquivo := &(Alias())->( DbInfo( DBI_FULLPATH ) )
Local cDiretorio:= iif ( Empty( cFilePath(cArquivo)) , Curdrive()+':\'+curdir()+'\',cFilePath(cArquivo) )
DEFAULT lCompact := .t.
DEFAULT lRecordSet := .f.
cSql := Upper( alltrim(cSql) )
oCn := FW_OpenAdoConnection( [Provider=Microsoft.Jet.OLEDB.4.0;Data Source=]+cDiretorio+[ ;Extended Properties=dBASE IV;User ID=Admin;Password=] ,.t.)
DEFAULT lExecute := !( LEFT( cSql, 7 ) == 'SELECT ' )
if oCn != nil
if lExecute
TRY
uRet := oCn:Execute( cSql )
CATCH
END
return uRet
else
oRs := FW_OpenRecordSet( oCn, cSql )
if lRecordSet
uRet := oRs
else
if oRs != nil
if oRs:RecordCount() > 0
uRet := oRs:GetRows()
oRs:MoveFirst()
endif
oRs:Close()
if lCompact
if Len( uRet ) == 1
uRet := uRet[ 1 ]
if Len( uRet ) == 1
uRet := uRet[ 1 ]
endif
endif
endif
endif
endif
endif
endif
return uRet