New AdoRDD (free)

Post Reply
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Srdjan,

All suggestions are welcome :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
digicad
Posts: 14
Joined: Sun Apr 29, 2007 2:04 pm
Location: Serbia
Contact:

GetValue

Post by digicad »

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
User avatar
digicad
Posts: 14
Joined: Sun Apr 29, 2007 2:04 pm
Location: Serbia
Contact:

dbAppend

Post by digicad »

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
User avatar
digicad
Posts: 14
Joined: Sun Apr 29, 2007 2:04 pm
Location: Serbia
Contact:

dbCreate

Post by digicad »

// 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Srdjan,

We are going to implement it in a different way.

We plan to publish it today :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
digicad
Posts: 14
Joined: Sun Apr 29, 2007 2:04 pm
Location: Serbia
Contact:

ADORDD

Post by digicad »

OK :)
TO BE or NOT TO BE

Srdjan Dragojlovic
www.digicad.biz
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Code: Select all

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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Our idea to implement DbCreate() for any ADO database engine is to use it this way:

Code: Select all

   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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Code: Select all

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
User avatar
Personal
Posts: 32
Joined: Sun Dec 03, 2006 12:05 pm
Location: BRASIL - Lins - SP
Contact:

Erro AdoRdd

Post by Personal »

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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

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

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Code: Select all

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
User avatar
Personal
Posts: 32
Joined: Sun Dec 03, 2006 12:05 pm
Location: BRASIL - Lins - SP
Contact:

AdoRdd

Post by Personal »

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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

use this usrrdd.lib with xHarbour:

http://rapidshare.com/files/29886887/usrrdd.lib.html
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Personal
Posts: 32
Joined: Sun Dec 03, 2006 12:05 pm
Location: BRASIL - Lins - SP
Contact:

AdoRdd

Post by Personal »

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
Post Reply