@@ -6456,6 +6456,61 @@ end rigDbInsert
64566456
64576457
64586458
6459+ /* ----------------------------------------------------------------------
6460+ --| COMMAND rigDBinsertQueryArray
6461+ --|
6462+ --| Author: rabit
6463+ --| Version: 1.0
6464+ --| Created: 2019-08-08
6465+ --| Last Mod: --
6466+ --| Requires: rigDbInsert(), dbErrorHandling
6467+ --|
6468+ --| Summary: Insert data returned by a database query.
6469+ --|
6470+ --| Format: rigDBinsertQueryArray param1, param2[, param3]
6471+ --|
6472+ --| Parameters: string <pTableName>, array <pTableA> the array returned by a query, bool <pReplace> (optional)
6473+ --|
6474+ --| Return: empty
6475+ ----------------------------------------------------------------------*/
6476+
6477+ command rigDBinsertQueryArray pTableName pTableA pReplace
6478+ local tTableKeys , tFieldNamesA , tNumFields
6479+ local tKey , tRowA , tFieldNum , tDataA
6480+
6481+ if pTableA is an array then
6482+
6483+ if pTableA ["numrows" ] > 0 then
6484+ put the keys of pTableA ["resultarray" ] into tTableKeys
6485+ sort lines of tTableKeys ascending numeric
6486+
6487+ put pTableA ["fieldnames" ] into tFieldNamesA
6488+ put the number of lines in the keys of tFieldNamesA into tNumFields
6489+
6490+ -- repeat for each key tKey in pTableA["resultarray"]
6491+ repeat for each line tKey in tTableKeys
6492+
6493+ put pTableA ["resultarray" ][tKey ] into tRowA
6494+
6495+ repeat with tFieldNum = 1 to tNumFields
6496+ put tRowA [tFieldNum ] into tDataA [tFieldNamesA [tFieldNum ]]
6497+ end repeat
6498+
6499+ get rigDbInsert(pTableName , tDataA , , pReplace )
6500+ if it is FALSE then
6501+ dbErrorHandling "Insertion failed!"
6502+ end if
6503+ end repeat
6504+ end if -- if pTableA["numrows"] > 0
6505+ end if -- if pTableA is an array
6506+ end rigDBinsertQueryArray
6507+
6508+
6509+
6510+
6511+
6512+
6513+
64596514/* ----------------------------------------------------------------------
64606515--| FUNCTION rigDbUpdate
64616516--|
0 commit comments