* Problem to solve when working with ADS remote server:
*----------------------------------------------------------------
UTF-8 unicode strings should be downloaded from Oracle or PgSQL table in
the Alaska Xbase ++ DBF table, but so that the correct text is preserved.
This was only possible through an ADT table that has a 'nchar' type field
for unicode characters.
I wrote a program that uses java JDBC to transfer unicode data from
Oracle table to ADT table. The data was successfully transferred to
the ADT table.
Now it is necessary to transfer data from the ADT table to the DBF table
with the previous one translating unicode characters into Esc sequences
(one unicode character = 6 ASCII characters)
Problem: Alaska ADSDBE opens and reads the ADT board. But if the ADT
board has an 'nchar' type field then ADSDBE does not see that field.
Function ADS_ADT_TABLE () is a test program that demonstrates this.
== Roger, Is there a way that the 'nchar' field can be seen from ADSDBE ? ==
Code: Select all
#include "Appbrow.ch"
*************************************************************************
FUNCTION ADS_ADT_TABLE()
*************************************************************************
* 1. SET ADS.INI
*---------------------------------------------
* [SETTINGS]
* ; 1 - Local, 2 - Client, 3 - Try Client, fall back to Local, 4 - Internet (AIS)
* ADS_SERVER_TYPE=2
* ; NTX or CDX or ADI
* ; ADS_INDEX_TYPE=CDX
* ; ADS_INDEX_TYPE=NTX
* ADS_INDEX_TYPE=ADI
* MTIER_LOCAL_CONNECTIONS=1
* 2. SET DBESYS()
*---------------------------------------------
* DbeLoad("ADSDBE")
* DbeSetDefault("ADSDBE")
* DbeInfo( COMPONENT_DATA , ADSDBE_TBL_MODE, ADSDBE_ADT)
* DbeInfo( COMPONENT_ORDER, ADSDBE_TBL_MODE, ADSDBE_ADT)
* DbeInfo( COMPONENT_DATA, ADSDBE_LOCK_MODE, ADSDBE_PROPRIETARY_LOCKING )
*---------------------------------------------
* 3. SET APPLICATION ADS SERVER SESSION
*---------------------------------------------
PUBLIC oSession, server_DRIVE := CurDrive() + ":"
// connect to the ADS server
cSession := "DBE=ADSDBE;SERVER=" + server_DRIVE
oSession := dacSession():New( cSession )
// check if we are connected to the ADS server
IF ( oSession:isConnected( ) ) == .F.
msgbox("Error: ADS Connection")
RETURN .F.
ENDIF
* 4. SET ADT TABLE
*-----------------
dbeSetDefault("ADSDBE")
//-------------------------------------------------- TEST1.ADT
//bErrorBlock := ErrorBlock({|e|_TrapError(e)})
//BEGIN SEQUENCE
USE TEST1.ADT NEW
*** Structure TEST1.ADT view in Advantage Data Architect:
*** field name INTEGER data type numeric size 15,0
*** field name REAL data type numeric size 16,2
//END SEQUENCE
//ErrorBlock(bErrorBlock)
APPBROWSE ;
TITLE "TEST1.ADT ---> There is not Field name: UNICODE type: nchar";
POSITION CENTER SIZE 40 PERCENT
APPDISPLAY
*** APPDISPLAY: INTEGER and REAL
USE // USE is OK
//-------------------------------------------------- TEST1.ADT
//-------------------------------------------------- TEST2.ADT
//bErrorBlock := ErrorBlock({|e|_TrapError(e)})
//BEGIN SEQUENCE
USE TEST2.ADT NEW
*** Structure TEST2.ADT view in Advantage Data Architect:
*** field name INTEGER data type numeric size 15,0
*** field name REAL data type numeric size 16,2
*** field name UNICODE data type nchar size 128 ***
//END SEQUENCE
//ErrorBlock(bErrorBlock)
APPBROWSE ;
TITLE "TEST2.ADT ---> There is a Field name: UNICODE type: nchar (not shown ?)";
POSITION CENTER SIZE 40 PERCENT
APPDISPLAY
*** APPDISPLAY: INTEGER and REAL, and not UNICODE ???
USE // USE is NOT OK: Error BASE/5:
// Description: Internal data structures corupted
// Operation: DbCloseArea
//-------------------------------------------------- TEST2.ADT
// disconnect from the ADS
oSession:disconnect()
RETURN .T.
STATIC FUNCTION _TrapError()
// disconnect from the ADS
oSession:disconnect()
BREAK
RETURN nil