FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour New AdoRDD (free)
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
New AdoRDD (free)
Posted: Tue May 01, 2007 09:45 AM

Srdjan,

All suggestions are welcome :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 14
Joined: Sun Apr 29, 2007 02:04 PM
GetValue
Posted: Tue May 01, 2007 02:56 PM

This change for correct GetValue if database is empty

STATIC FUNCTION ADO_GETVALUE( nWA, nField, xValue )

LOCAL aWData := USRRDD_AREADATA( nWA )
LOCAL oADO := USRRDD_AREADATA( nWA )[ 1 ]

IF aWData[ 3 ]
xValue := ""
ELSE
IF oADO:BOF .AND. oADO:EOF
xValue := NIL
ELSE
xValue := oADO:Fields( nField - 1 ):Value
ENDIF
ENDIF

RETURN SUCCESS

TO BE or NOT TO BE

Srdjan Dragojlovic
www.digicad.biz
Posts: 14
Joined: Sun Apr 29, 2007 02:04 PM
dbAppend
Posted: Tue May 01, 2007 04:29 PM

STATIC FUNCTION ADO_APPEND( nWA, lUnLockAll )

    local oADO := USRRDD_AREADATA( nWA )[ 1 ]

    oADO:AddNew()
    TRY
        oADO:Update() // keep it here, or there is an ADO error
    CATCH
    END

RETURN SUCCESS

Must add code TRY/CATCH if oADO:Update() create error

TO BE or NOT TO BE

Srdjan Dragojlovic
www.digicad.biz
Posts: 14
Joined: Sun Apr 29, 2007 02:04 PM
dbCreate
Posted: Tue May 01, 2007 04:56 PM
// Creating fields for new DBF - dbCreate() in current workarea
STATIC FUNCTION ADO_CREATEFIELDS( nWA, aStruct )
LOCAL aWData := USRRDD_AREADATA( nWA )

aWData[ 1 ] := { ;
NIL ,; // DATABASE_FILENAME
{} ,; // DATABASE_RECORDS
{} ,; // DATABASE_RECINFO
0 ,; // DATABASE_OPENNUMBER
FALSE ,; // DATABASE_LOCKED
aStruct; // DATABASE_STRUCT
}

RETURN SUCCESS

STATIC FUNCTION ADO_CREATE( nWA, aOpenInfo )
LOCAL aWData := USRRDD_AREADATA( nWA )
LOCAL aRData := USRRDD_RDDDATA( USRRDD_ID( nWA ) )
LOCAL aField, oError, cName
LOCAL cFullName, aDBFData
LOCAL cCMD := "CREATE TABLE "
Local aStruct, I


/* getting database infos from current workarea */
aDBFData := aWData[ 1 ]
aStruct := aWData[ 1 ][ 6 ]

/* setting in uppercase chars to avoid differences */
cFullName := Upper( aOpenInfo[ UR_OI_NAME ] )

// When there is no ALIAS we will create new one using file name
IF aOpenInfo[ UR_OI_ALIAS ] == NIL
HB_FNAMESPLIT( cFullName, , @cName )
aOpenInfo[ UR_OI_ALIAS ] := cName
ENDIF

// Check if database is already present in memory slots
IF !( cFullName IN aRData )

// Setting file attribs
aDBFData[ 1 ] := cFullName
aDBFData[ 5 ] := TRUE /* I need Exclusive mode in creation */

cCMD += cFullName+" ( "
FOR I=1 TO LEN( aStruct )
cCMD += aStruct[i,1]+" "
IF aStruct[i,2]=="C"
cCMD += "VARCHAR("+ALLTRIM(STR(aStruct[i,3]))+")"
ELSEIF aStruct[i,2]=="M"
cCMD += "VARCHAR("+ALLTRIM(STR(aStruct[i,3]))+")"
ELSEIF aStruct[i,2]=="N"
cCMD += "NUMERIC("+ALLTRIM(STR(aStruct[i,3]))+","+ALLTRIM(STR(aStruct[i,4]))+" )"
ELSEIF aStruct[i,2]=="D"
cCMD += "DATE"
ENDIF
IF i==LEN(aStruct)
cCMD += " )"
ELSE
cCMD += ", "
ENDIF
NEXT I

if s_cConnection != NIL
TRY
s_cConnection:Execute( "DROP TABLE "+cFullName )
CATCH
END
TraceLog( cCMD )
s_cConnection:Execute( cCMD )
endif

// Adding new database in RDD memory slots using filename as key

ELSE

// ERROR: database already exists

oError := ErrorNew()

oError:GenCode := EG_CREATE
oError:SubCode := 1004 // EDBF_CREATE_DBF
oError:Description := HB_LANGERRMSG( EG_CREATE ) + " (" + ;
HB_LANGERRMSG( EG_UNSUPPORTED ) + " - database already exists)"
oError:FileName := aOpenInfo[ UR_OI_NAME ]
oError:CanDefault := .T.
UR_SUPER_ERROR( nWA, oError )

RETURN FAILURE

ENDIF

// Set WorkArea Info
aWData[ 3 ] := aOpenInfo // Put open informations

// increase open number
aDBFData[ 4 ]++

RETURN SUCCESS

Add this code in ADORDD.PRG

aMyFunc[ UR_CREATE ] := ( @ADO_CREATE() )
aMyFunc[ UR_CREATEFIELDS ] := ( @ADO_CREATEFIELDS() )

Add this two line into FUNCTION ADORDD_GETFUNCTABLE( pFuncCount, pFuncTable, pSuperTable, nRddID )

Test it ! :-)

dbCreate is work :-)
TO BE or NOT TO BE

Srdjan Dragojlovic
www.digicad.biz
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
New AdoRDD (free)
Posted: Tue May 01, 2007 06:15 PM

Srdjan,

We are going to implement it in a different way.

We plan to publish it today :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 14
Joined: Sun Apr 29, 2007 02:04 PM
ADORDD
Posted: Tue May 01, 2007 06:20 PM

OK :)

TO BE or NOT TO BE

Srdjan Dragojlovic
www.digicad.biz
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
New AdoRDD (free)
Posted: Tue May 01, 2007 09:00 PM
2007-05-01 22:53 UTC+0100 Antonio Linares (alinares@fivetechsoft.com)
   * contrib/adordd/adordd.prg
     * DbCreate() implementation just for Microsoft Access

   + contrib/adordd/access2.prg
     * DbCreate() sample with Microsoft Access


www.fivetechsoft.com/files/adordd.zip
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
New AdoRDD (free)
Posted: Tue May 01, 2007 09:54 PM
Our idea to implement DbCreate() for any ADO database engine is to use it this way:
   DbCreate( "test00;test;MYSQL;www.freesql.org;myuser;mypass",;
             { { "FIRST", "C", 10, 0 },;
               { "LAST",  "C", 10, 0 },;
               { "AGE",   "N",  8, 0 } }, "ADORDD" )
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
New AdoRDD (free)
Posted: Sat May 05, 2007 08:32 AM
2007-05-05 10:28 UTC+0100 Antonio Linares (alinares@fivetechsoft.com)
   * contrib/adordd/adordd.prg
     * Improved formatting and xharbour compatibility


www.fivetechsoft.com/files/adordd.zip
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 32
Joined: Sun Dec 03, 2006 12:05 PM
Erro AdoRdd
Posted: Sun May 06, 2007 12:32 AM

Que error puede ser ese.

rror: Unresolved external '_hb_vmProcessSymbolsEx' referenced from T:\FWH_28\XHARBOUR\LIB\ADORDD.LIB|adordd

S.A.Oliveira

Lins-SP - Brasil

FWH 10.9, PellesC,MySql
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
New AdoRDD (free)
Posted: Sun May 06, 2007 08:46 PM

You have to build the ADORDD.lib using your Harbour/xHarbour build

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
New AdoRDD (free)
Posted: Sun May 06, 2007 08:47 PM
2007-05-06 11:42 UTC+0100 Antonio Linares (alinares@fivetechsoft.com)
   * contrib/adordd/adordd.ch
     * New define added
     
   * contrib/adordd/adordd.prg
     * SET RELATION implementation


www.fivetechsoft.com/files/adordd.zip
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 32
Joined: Sun Dec 03, 2006 12:05 PM
AdoRdd
Posted: Sun May 06, 2007 10:34 PM

Sou novo e estou apanhando um bocado.

Error: Unresolved external '_hb_itemMove' referenced from T:\FWH_28\XHARBOUR\LIB\USRRDD.LIB|usrrdd

S.A.Oliveira

Lins-SP - Brasil

FWH 10.9, PellesC,MySql
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
New AdoRDD (free)
Posted: Sun May 06, 2007 10:56 PM

use this usrrdd.lib with xHarbour:

http://rapidshare.com/files/29886887/usrrdd.lib.html

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 32
Joined: Sun Dec 03, 2006 12:05 PM
AdoRdd
Posted: Mon May 07, 2007 12:24 AM

Ok, com bancos .MDB.

Com banco MySql:
Error description: Error ADODB.Connection/16389 E_FAIL: OPEN

Args: [ 1] = C DRIVER={MySQL ODBC 3.51 Driver};server=192.168.0.254;database=ARQPRO;uid=newuser;pwd=newsenha

Stack Calls

Called from: win32ole.prg => TOLEAUTO:OPEN(0)
Called from: => ADO_OPEN(221)
Called from: => DBUSEAREA(0)
Called from: teste.prg => MAIN(9)

S.A.Oliveira

Lins-SP - Brasil

FWH 10.9, PellesC,MySql