Topic complex |
Table functions |
Function |
setrecord() |
Short |
Copies a record from another table |
Syntax |
SETRECORD(db_from, db_to : INTEGER[; mode: INTEGER]) : INTEGER |
Parameter |
db_from, db_to : table handles from OpenDB |
Return |
Always 0 |
See also: |
|
Description |
If an invalid table handle is used a runtime error occurs.
Taking over the seperate fields takes place via the field identifier, having more than one equal field identifiers in one table also the direction is considered. That is: the first field with the label x of the table db_from is assigned to the first field with the label x of the table db_to.
Types are widely changed:
MEMO -> STRING (not possible)
STRING -> MEMO (possible)
With SETRECORD also contents of AUTO-INCEMENT fields are taken over. If a new number is generated then depends on how the mode is set at WRITEREC.
Speciality:
SETRECORD creates MEMO and BLOB entries in the target table. If the record is not written to the target table afterwards, though this informations are included in the MMO and/or BLB file, but you can not access to them.
It is also possible to use SETRECORD with a table to itself. In this case a copy with MEMO and BLOB informations is created which can be written with WriteRec(db,filesize(db)+1) then. This procedure is always reasonable if a record with MEMO and/or BLOB fields should be copied. Otherwise the pointers are copied to th MEMO and/or BLOB file, what can lead to their destruction!
|