602SQL Documentation Index  



boolean wb_data_transport( resource connection, string move_descr_obj_name, mixed src_conn, mixed trg_conn, string src_schema, string trg_schema, string src_name, string trg_name, int src_format, int trg_format, int src_code, int trg_code, int flags )


Identifier of the open connection returned by the wb_connect or wb_pconnect functions.
Name of the object defining the data transfer or NULL.
Connection to the data transfer source.
Connection to the data transfer target.
Scheme in the data transfer source.
Scheme in the data transfer target.
Table, query or file containing the source data.
Table or file to write data.
Format of the data transfer source.
Format of the data transfer target.
Source file coding.
Target file coding.
Flags affecting the function.


This function provides data transfer between 602SQL Servers, ODBC data sources and files in various formats.

The transfer description is in the move_descr_obj_name object. If the move_descr_obj_name is set (not NULL), then the function will read this description from the database connected with the connection identifier to the connection database. The entries set in the transfer description are then modified according to the function parameters beginning with the src_schema parameter. If some parameter equals NULL or -1, it will be ignored and the entry from the transfer description will be used.

The src_conn and trg_conn parameters represent connection to the data source and target. They may equal NULL only if the source/target is a text or DBF file.

If the move_descr_obj_name is NULL, then the function will create a default transfer design based on the function parameters in the same way as the interactive designer. The connection parameter value is ignored.

If the flags parameter is set to 1, then indexes will not be rebuilt in real time when transferring data into a 602SQL table. The index will be discarded and rebuilt from scratch after the transfer is done. This may affect the operation time depending on the amount of data in the table before the transfer and the amount of transferred data.

Type and format of the target and source of the data transfer are further described by the src_format and trg_format parameters according to the following table:

IMPEXP_FORMAT_WINBASE 0 File in the internal 602SQL format (TDT)
IMPEXP_FORMAT_TEXT_COLUMNS 1 Text file in columns
IMPEXP_FORMAT_TEXT_CSV 2 Text file in the CSV format
IMPEXP_FORMAT_DBASE 3 File in the dBase IV (DBF) format
IMPEXP_FORMAT_FOXPRO 4 File in the FoxPro 2.0 (DBF) format
IMPEXP_FORMAT_ODBC 5 Table from an ODBC data source
IMPEXP_FORMAT_CURSOR 6 Query stored in a 602SQL database (only for src_format)
IMPEXP_FORMAT_ODBCVIEW 7 Query in an ODBC data source

Based on the parameter values, the data source and target are described in one of these ways:

Table or Query in 602SQL

A table can be both a target or a source of the data transfer. A query may only be the source. The connection identifier to 602SQL (the result of the wb_connect or wb_pconnect function) is then the src_conn or trg_conn parameter. The scheme on this server is then the src_schema or trg_schema and the table name or the query in this scheme is then the src_name or trg_name parameter. The src_code or trg_code parameter values are ignored.

The specified scheme and source table or query must exist. If the data transfer target is a database table, that does not exist yet, it will be created according to the transfer design.

Table or Query Accessed via ODBC

A table can be both the source and target of data transfer; a query can be only the source. The src_conn or trg_conn parameter then describes connection to the ODBC data source:

If the array is passed, then wb_data_transport function opens connection to the ODBC data source, it executes the transfer and closes the connection. When transferring the open connection to the ODBC data source, this function does not close the connection (it is closed by means of wb_odbc_disconnect).

The src_schema or trg_schema parameter is an eventual schema or another qualifier of the object names in this ODBC data source and the src_name or trg_name is table name or query name. As long as the ODBC data source does not use schemas or other qualifiers, then an empty string could be a parameter determining this schema. Value of the src_code or trg_code parameter is ignored.

Both the source and target must exist.

File in a supported format

The src_name or trg_name parameter contains the file name (usually with the full path). The src_conn and src_schema or trg_conn and trg_schema parameter values are ignored. The src_code or trg_code parameter value describes the file coding as follows:

Value Coding
0 Windows cp1250 (east European languages)
1 Windows cp1252 (west European languages)
3 ISO 8859-2 (east European languages)
4 DOS cp852 (LATIN 2) (east European languages)
5 ISO 8859-1 (west European languages)
6 UTF-8
7 UCS-2
6 UCS-4

This function has the same restrictions as the Data_transport function.


TRUE if successful, otherwise it is FALSE.


Data transfer from an ODBC data source to a 602SQL table (1. method - I have created an object of the transfer type (in this case called MySQLODBC_602tab) - it is better in the possibility to verify the transfer in the 602SQL Client in advance):

  $conn=wb_connect($cfg_dbconn_database,$cfg_dbconn_application,$cfg_dbconn_username,$cfg_dbconn_password) or die;
  $odbc_resource=wb_odbc_connect("MySQL test","user","password") or die("MySQL odbc connect failed");

  $result = wb_data_transport(
  if( $result==FALSE ) { /* handle the error */ }
  else { echo "transfer succesful\n"; };

Data transfer from the ODBC data source to the table in 602SQL (2. method - I need not have created an object of the transfer type, however, if the transfer fails, it is very complicated to find an error):

  $conn=wb_connect($cfg_dbconn_database,$cfg_dbconn_application,$cfg_dbconn_username,$cfg_dbconn_password) or die;

  $result = wb_data_transport(
    array("dsn" => "odbc_data_source_name","uid" => "user","pwd" => "password"),
  if( $result==FALSE ) { /* handle the error */ }
  else { echo "transfer succesful\n"; }