Class CODBLIST

Name

CODBLIST  --  CODB Class are destined to control of the list accessibile dictionary. In yours system (computer, local network, VPN, internet) may be many CODB data sourses (in configuration by default 32,000,000 ). CODB it is those class what provide DB supporting with methods description for access to certain CODB. The information keeping into $CLIPROOT/etc/codb.dbf

Synopsis

 CODBListNew() --> CODB object
 CODBList:New()  --> CODB object

Description

CODB Class are destined to control of the list accessibile dictionary.

In yours system (computer, local network, VPN, internet) may be many CODB data sourses (in configuration by default 32,000,000 ). CODB it is those class what provide DB supporting with methods description for access to certain CODB.

The information keeping into $CLIPROOT/etc/codb.dbf

Attributes

<ClassName> CODBLIST
<Error> String, the error description what araised within running last operation.

Methods

APPEND Add to list new CODB specifier.
CLOSE Close DB.
CONNECT Open DB.
EXISTID Check CODB identifier into list accessible CODB.
GETVALUE Get dictionary by CODB identifier.
LIST Returns list CODB what registered in system.
NEW Initiation new CODBLIST object.
UPDATE Update CODB description.

Method CODBLIST:APPEND()

 Append(<oCodbData>) 	--> TRUE || FALSE

Append() returns TRUE if new CODB specifier added. The <oCodbData> must be contain property <ID>. This property specified CODB identifier.

The <oCodbData> can be contain property <TYPE> - the type of dictionary. By default it is CODB_DICTTYPE_DEFAULT. If <TYPE> is "DBF", then <oCodbData> can be contain attribute <PATH> - full path to dbf file (by default it is /home/$USER/codb+<ID>)

The properties of <oCodbData> see in file <"codbcfg.ch">

ID - CODB identifier and this one  dictionary identifier (5 byte) NAME - CODB name TYPE - driver type to access to data: DBF - DBF (by default) MS  - MySQL PG  - Postgress OR  - Oracle IB  - Interbase and Firebird ODBC - ODBC data source PATH - path to data (only for DBF) HOST - name and IP address SQL server PORT - TCP port of SQL server USER - SQL-server user DBNAME - DB name into SQL server 

<::Error> contain error descriptions if araised.

Method CODBLIST:CLOSE()

 Close() 	--> NIL

Close() closes all files, connections, DB.

Method CODBLIST:CONNECT()

 Connect(<sCodbID>[, <sUser>[, <sPasswd>]]) 	--> <oDict>

Connect() openes DB with identifier <sCodbID>. Made connect with SQL-server (if source is SQL-server) or openes necessary files and returns object of DICTIONARY class <oDict>.

<::Error> contain error descriptions if araised.

Method CODBLIST:EXISTID()

 ExistId(<sCodbId>) 	--> TRUE || FALSE

ExistId() returns TRUE if CODB with identifier <sCodbId> is exist into list of registered CODB. In other returns FALSE.

<::Error> contain error descriptions if araised.

Method CODBLIST:GETVALUE()

 GetValue(<sCodbID>) 	--> <oDict>

GetValue() returns object of DICTIONARY class - <oDict> with identifier <sCodbID>.

<::Error> contain error descriptions if araised.

Method CODBLIST:LIST()

 List() 	--> <aList>

List() returns list of registered CODB - <aList>. Every element of <aList> is string what contain CODB identifier and CODB name via <:>

Method CODBLIST:NEW()

 New() --> CODBLIST object

New() inits new CODBLIST object and returns it.

Method CODBLIST:UPDATE()

 Update(<oCodbData>) 	--> TRUE || FALSE

Update() returns TRUE if CODB specifier updated. The <oCodbData> must be contain property <ID>. This property specified CODB identifier.

The <oCodbData> can be contain property <TYPE> - the type of dictionary. By default it is CODB_DICTTYPE_DEFAULT. If <TYPE> is "DBF", then <oCodbData> can be contain attribute <PATH> - full path to dbf file (by default it is /home/$USER/codb+<ID>)

<::Error> contain error descriptions if araised.

Example:

  dList := codbList():new()
 
 if !empty(dList:error)
 ? "Error:" dList:error
 quit
 endif
 
 dle      := map()
 dle:id   := "MY001"
 dle:name := "my first CODB"
 dle:type := "DBF"
 dle:path := "/home/my_user_name/codb/MY001"
 
 if dList:existId(dle:ID)
 dList:update(dle)
 else
 dList:append(dle)
 endif
 
 if !empty(dList:error)
 ? "Error:" dList:error
 quit
 endif
 
 oDict := dList:connect("MY001")
 ? oDict  // see descriptions of DICTIONARY class
 
 dList:close()
 quit
 

See also

CODBDICTIONARY

Platforms

No dependies of platform.