OC Clone 4D table

4D - Documentation   Français   English   German   4D ODBC, Command Theme List   4D ODBC, Command Alphabetical List   Back   Previous   Next

version 6.0 (Modified)


OC Clone 4D table (connection_ID{; 4DTableNbr{; options}}) Integer

ParameterTypeDescription
connection_IDLongintLogin_ID
4DTableNbrInteger4D table number
optionsLongintOptions
Function resultInteger1 = the operation is successful,
0 = the user clicks Cancel
-1 = an error occurs

Description

The OC Clone 4D table command creates a table on your data source with column definitions equivalent to a 4th Dimension table.

connection_ID must be a valid login or cursor ID. If you use a valid login ID, 4D ODBC will automatically open and close a cursor for use with this function. If you pass a valid cursor ID, this function will use the specified cursor.

4DTableNumber is the number of the 4th Dimension table whose structure is duplicated.

options is a combination of options. Several options can be chosen by adding their values. The options are the following:

Replace=1OC Clone 4D table generates a DROP TABLE statement before creating the
new table.
WithoutSubtab=2OC Clone 4D table ignores subtables. The cloning of subtables is not currently
supported. This option must be requested for any table containing a subtable.
WithoutText=4OC Clone 4D table ignores fields of the Text type.
WithoutPicture=8OC Clone 4D table ignores fields of the Picture type.
kWithout=16OC Clone 4D Table ignores fields of the BLOB type.

If 4DTableNbr is not specified, OC Clone 4D table displays the Clone 4D Table dialog box.

The pop-up menu allows you to choose the 4th Dimension table to be cloned and the check boxes list the available options.

The new table has the name of the 4th Dimension table and its columns have the names of the fields in the 4th Dimension table. If a field name contains spaces, the spaces are replaced by underscores.

Types are converted according to the following rules:

4th DimensionODBC
Alpha (length)SQL_CHAR
TextSQL_LONGVARCHAR
RealSQL_DECIMAL
IntegerSQL_INTEGER
LongintSQL_BIGINT
DateSQL_DATE
HourSQL_TIME
BooleanSQL_BIT
PictureSQL_BINARY
BLOBSQL_BINARY

Consult your specific ODBC driver to see how the column is created on your data source.

If a 4th Dimension field has the Mandatory attribute, the corresponding column is created with the NOT NULL option.

An index is created for each indexed field. Its name is a concatenation of the 4th Dimension tablename, the "$" sign and the field name, prefixed by "I_" and a sequence number for the table. For example, an index for the Sal field of the EMP table is named "I_EMP$SAL".

If a 4D field has the Unique attribute, the index is created with the UNIQUE option.

OC Clone 4D table returns 1 if the operation is successful, 0 if the user clicks Cancel in the dialog box, and -1 if an error occurs.

Example

The following method copies the files in the 4D database to the ODBC server. If a table already exists on the server, it is automatically replaced.

   Login_ID:=OC Login dialog
   If(Login_ID>0)
      For($i;1;Count tables)
         rc:=OC Clone 4D table(Login_ID;$i;1)
      End for
   End if

See Also

OC Login.

System Variables and Sets

If the user clicks OK, the OK system variable is set to 1. If the user clicks Cancel, the OK system variable is set to 0.


4D - Documentation   Français   English   German   4D ODBC, Command Theme List   4D ODBC, Command Alphabetical List   Back   Previous   Next