Page 11 of 18

PostPosted: Mon May 14, 2007 11:50 am
by Antonio Linares
Athayde,

>
HB_AdoRddGetRecordset():Supports( adIndex )
returns .F.
why?
i'm using MYSQL 4.1
>

We don't know it :-)

http://www.w3schools.com/ado/met_rs_supports.asp

> you testing with what GDB?

Access and MySQL (www.freesql.org). Some users are testing with Microsoft SQL too

PostPosted: Mon May 14, 2007 12:42 pm
by athayde
Antonio,

Why code the ADORDD.PRG in xharbour_cvs is different of your?
in xharbour_cvs supports firebird
are projects differents?

Regards

PostPosted: Mon May 14, 2007 12:52 pm
by athayde
but which is your version of MYSQL?

Thanks

PostPosted: Mon May 14, 2007 1:01 pm
by athayde
use mysql1.prg
USE test00 VIA "ADORDD" TABLE "ACCOUNTS" MYSQL ;
FROM "www.freesql.org" USER "myuser" PASSWORD "mypass"
INDEX ON FIRST TO X_FIRST


Browse()

not error, but not ordened

PostPosted: Mon May 14, 2007 1:36 pm
by athayde
stranger no?
with Mysql 4.1 functions perfectly
USE ceif VIA "ADORDD" TABLE "aplica" MYSQL ;
FROM "localhost" USER "root" PASSWORD "masterkey" ALIAS "aplica"

with Mysql 5.0.37 error:
Error ADODB.Recordset/16389 E_FAIL: OPEN Arguments: ( [ 1] = Type: C Val: aplic
a [ 2] = Type: O Val: { TOLEAUTO Object })

Error at ...: TOLEAUTO:OPEN(0) in Module: win32ole.prg
Called from : ADO_OPEN(273) in Module: ADORDD.PRG
Called from : DBUSEAREA(0) in Module:

Regards

PostPosted: Mon May 14, 2007 4:30 pm
by athayde
the solution for this error is:
static function ADO_OPEN( nWA, aOpenInfo )

local aWAData := USRRDD_AREADATA( nWA )
local cName, aField, oError, nResult
local oRecordSet, nTotalFields, n

// When there is no ALIAS we will create new one using file name
if aOpenInfo[ UR_OI_ALIAS ] == nil
HB_FNAMESPLIT( aOpenInfo[ UR_OI_NAME ], , @cName )
aOpenInfo[ UR_OI_ALIAS ] := cName
endif

aWAData[ WA_CONNECTION ] = TOleAuto():New( "ADODB.Connection" )
aWAData[ WA_TABLENAME ] = s_cTableName
IF EMPTY(s_cQuery)
s_cQuery = "SELECT * FROM "
ENDIF


Regards

PostPosted: Mon May 14, 2007 7:31 pm
by athayde
Antonio,

about query, i see another thing
in ADO_OPEN
IF aWAData[ WA_QUERY ]=="SELECT * FROM "
oRecordSet:Open( aWAData[ WA_QUERY ] + aWAData[ WA_TABLENAME ], aWAData[ WA_CONNECTION ] )
ELSE
oRecordSet:Open( aWAData[ WA_QUERY ], aWAData[ WA_CONNECTION ] )
ENDIF

but, when USE command, not open HB_AdoSetQuery( <cQuery> ) function when not have a Query, only open function if Query exist, then forever push the last query

EX:
SELE 0
USE ceif VIA "ADORDD" ALIAS "S" TABLE "s" MYSQL FROM "localhost" USER "root" PASSWORD "masterkey"
< the query is a SELECT * FROM S >

but, if open with Query
SELE 0
USE ceif VIA "ADORDD" ALIAS "ABC" TABLE "ABC" MYSQL FROM "localhost" USER "root" PASSWORD "masterkey" QUERY "SELECT * FROM ABC ORDER BY nomeus"
< the query is a SELECT * FROM ABC ORDER BY nomeus >

but if open without Query again
SELE 0
USE ceif VIA "ADORDD" ALIAS "TTT" TABLE "TTT" MYSQL FROM "localhost" USER "root" PASSWORD "masterkey"
< the query is a SELECT * FROM ABC ORDER BY nomeus >

not cleaning query when open new alias

Regards

PostPosted: Mon May 14, 2007 7:58 pm
by athayde
about LOCATE with AND or "OR"
ADO limitation
Note: This method does not support multi-column searches (AND or OR)

Regards

PostPosted: Mon May 14, 2007 8:53 pm
by athayde
Antonio,
fix for return size correct
Code: Select all  Expand view
static function ADO_GETVALUE( nWA, nField, xValue )

   local aWAData := USRRDD_AREADATA( nWA )
   local oRecordSet := USRRDD_AREADATA( nWA )[ WA_RECORDSET ]
   local lChar,nADOFieldType

   if aWAData[ WA_EOF ] .or. oRecordSet:RecordCount() == 0
      xValue := nil
   else
      xValue := oRecordSet:Fields( nField - 1 ):Value
      nADOFieldType=oRecordSet:Fields( nField - 1 ):Type
      lChar=.F.
      IF nADOFieldType == adDBDate
         lChar=.T.
      ELSEIF nADOFieldType == adDBTime
         lChar=.T.
      ELSEIF nADOFieldType == adDBTimeStamp
         lChar=.T.
      ELSEIF nADOFieldType == adBSTR
         lChar=.T.
      ELSEIF nADOFieldType == adChar
         lChar=.T.
      ELSEIF nADOFieldType == adVarChar
         lChar=.T.
      ELSEIF nADOFieldType == adLongVarChar
         lChar=.T.
      ELSEIF nADOFieldType == adWChar
         lChar=.T.
      ELSEIF nADOFieldType == adVarWChar
         lChar=.T.
      ENDIF
      IF lChar
         xValue := xValue+SPACE( oRecordSet:Fields( nField - 1 ):DefinedSize - LEN(xValue) )
      ENDIF
   endif

return SUCCESS


function ADO_GETFIELDTYPE it stranger i can't compares with HB_FT_STRING

Regards[/code]

PostPosted: Tue May 15, 2007 11:16 am
by athayde
Great,
see my modification for uses QUERYs differents, is possible?

PostPosted: Tue May 15, 2007 2:22 pm
by athayde
a Question:
DBRLOCK() only returns .T.?

Regards

PostPosted: Wed May 16, 2007 12:03 pm
by athayde
the adordd in xharbour CVS is the some project?

PostPosted: Wed May 16, 2007 12:35 pm
by Adolfo
Fernando y/o Antonio

Estoy inicando las pruebas con Mysql 5 y tengo lo siguiente:

Poseo el nombre de usuario y clave del root
Mysql corriendo localmente ( en 127.0.0.1 localhost )

Quisiera poder
1.- Conectarme al Servidor Mysql
2.- Crear una Base de datos
3.- Crear las tablas

Cualquier ayuda bienvenida sera... y si me funciona mi "invento" lo compartire con UDS.

Desde Chile
Adolfo

PostPosted: Wed May 16, 2007 12:39 pm
by jose_murugosa
La versión que obtenemos aquí sirven tanto para Harbour como para xHarbour, verdad?

Funciona con PostgreSQL?

PostPosted: Wed May 16, 2007 12:41 pm
by Antonio Linares
Adolfo,

Para comenzar es preferible que crees la base de datos con una utilidad como el Navicat. Luego prueba el ejemplo mysql1.prg que proporcionamos con ADORDD