OC Clone ODBC 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 ODBC table (login_ID{; tableName}) Integer

ParameterTypeDescription
login_IDLongintLogin ID
tableNameStringName of the 4D table
Function resultInteger1= The operation is successful,
0 = The user clicks Cancel,
-1= An error occurs

Description

The OC Clone ODBC table function creates a 4th Dimension table with field definitions equivalent to the ODBC table.

login_ID must be a valid login.

If you do not pass the second parameter, OC Clone ODBC table displays the Clone Table dialog box.

Passing the tableName as the second parameter will force the command to clone the table whose name has been passed instead of letting the user select it. The 4D table will bear the same name.

The new table has the name FileN, where N is the table number. The field names are the names of the columns on the ODBC data source.

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

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

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

If the user clicks Cancel in the Clone ODBC Table dialog box, the OK system variable is set to 0.

Example

The following method clones locally all the tables found on the data source:

   ` OC CloneDB (CursorID)
   ` CursorID : Longint, from OC Create cursor.

   C_LONGINT ($curs)
   $curs := $1
   ARRAY STRING(15;t1;0)
   ARRAY STRING(15;t2;0)
   ARRAY STRING(60;tab_name;0)
   ARRAY STRING(15;tab_type;0)
   ARRAY STRING(15;t5;0)
   
   OC GET TABLE LIST ($curs;"t1";"t2";"tab_name";"tab_type";"t5")
   For ($i;1;Size of array(tab_type))
      If (tab_type{$i}="table")
         MESSAGE("Clone table:"+tab_name{$i})
      $r:=OC Clone ODBC table (l;tab_name{$i})
      End if 
   End for 

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