DC_Array2SQLInsert()

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
unixkd
Posts: 579
Joined: Thu Feb 11, 2010 1:39 pm

DC_Array2SQLInsert()

#1 Post by unixkd »

Hi Roger

This function exist in Express++ doc, but not coded in dclipx.

dc_array2sqlinsert()
Create SQL statement for inserting records
DC_Array2SQLInsert() is used to create a SQL statement for inserting records into a database. This accepts an 2-dimensional array that matches the order of fields or a 1-dimensional array of record objects.
Syntax:
DC_Array2SQLInsert( <aData>, <cTable> ) -> cSQLStatement


Returns:
A character string.

Arguments:
<aData> is a 2-dimensional array of values to write to the database
or a 1-dimensiona array of record objects to write to the database.


Notes:
This function is handy when processing a lot of transactions thatrequire adding many records to a database at one time. Normalappend() require locking and unlocking and also take a considerableamount of time. SQL INSERT, on the other hand, is very fastbecause everything is being done on the server. In additiona BEGIN TRANSACTION is put into the SQL at the beginning and aCOMMIT WORK at the end. This insures that no other task orworkstation can write to the database until all records areinserted.

Examples:
USE TRANS

aRecords := {}

oRecord := DC_DBRecord():new()
TRANS->(dbGoTo(0))

oRecord:date := Date()
...
oRecord:tran_type := 'LOGIN'

AAdd(aRecords,oRecord)

cSQL := DC_Array2SqlInsert(aRecords)
Files:
_DCSQL.PRG, DCLIPX.DLL
See Also:
dc_adsstatement()


User avatar
rdonnay
Site Admin
Posts: 4813
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: DC_Array2SQLInsert()

#2 Post by rdonnay »

I suspect that you have an old version of DCLIPX.LIB in your SET LIB path.

That function is in the most current DCLIPX.LIB and DCLIPX.DLL.
The eXpress train is coming - and it has more cars.

Post Reply