DBBrowser
Mark Johnson, Berlin Germany
mj10777@gmx.net

###
Remstar ODBC Classes :
The new wxDB::GetColumns() Function
Description

(English)

Stand: 2000-01-23.01-mj10777

There are 2 new wxDB Functions :

wxColInf *wxDB::GetColumns(char *tableName, int *numCols, const char *userID)

This Function stores all (int numCols) information from the Table (char *tableName). It returns the result in a wxColInf Stucture (Class)

int wxDB::GetKeyFields(char *tableName, wxColInf* colInf,int noCols)

Tries to find out if any (int noCols) of the columns (wxColInf* colInf) in the Table (char *tableName) are Primary or Foreign Keys.

This Function is only called from GetColumns().

There are 4 new wxDB Classes (Structures) :

wxDbInf

This Class stores all ODBC-Information for a Database :

Catalog Entry (char catalog[128+1]),
Schema (char schema[128+1])
the number of Tables found(int numTables)
and a Pointer (wxTableInf* pTableInf) Structure is stored.

wxTableInf

This Class stores all ODBC-Information about a Table :

Table-Name (char tableName[DB_MAX_TABLE_NAME_LEN+1]),
Table-Type (char tableType[254+1]) - "TABLE", "SYSTEM TABLE" etc. ,
Table-Remarks (char tableRemarks[254+1]),
the number of Columns found(int numCols)
and a Pointer (wxColInf* pColInf) Structure is stored.

wxColInf

This Class stores all ODBC-Information about a Column :

Catalog Entry (char catalog[128+1]),
Schema (char schema[128+1])
Table-Name (char tableName[DB_MAX_TABLE_NAME_LEN+1]),
Column-Name (char colName[DB_MAX_COLUMN_NAME_LEN+1]),
Datatype (from SQL) (SWORD sqlDataType),
Data-Name(from SQL) (char typeName[128+1]),
Column size(from SQL) (SWORD columnSize),
Buffer length(from SQL) (SWORD bufferLength),
Decimal digits(from SQL) (short decimalDigits),
numPrecRadix (from SQL) (short numPrecRadix),
Nullable (from SQL) (short nullable),
Remarks (char remarks[254+1]),
Datatype (from wxDB) (int dbDataType),
Primary-Key (int PkCol) 0=No; 1= First Key, 2 = Second Key etc.,
Tables that use this Key as a Foreign Key(char PkTableName[DB_MAX_TABLE_NAME_LEN+1]),
Foreign-Key (int FkCol) 0=No; 1= First Key, 2 = Second Key etc.,
Table-Name where this Foreign-Key is Primary Key(char FkTableName[DB_MAX_TABLE_NAME_LEN+1]),
and a Pointer (wxColFor* pColFor) Structure is stored.

wxColFor

This Class stores how this Column should be formatted in a String :

Output String (wxString s_Field),
Formatted Objects (TIMESTAMP needs 7) (wxString s_Format[7]),
Formatted Objects (wxString s_Menge[7]),
Formatted Objects (TT MM YYYY HH MM SS m) (int i_Menge[7]),
National (0=timestamp,1=EU,2=UK,3=International,4=US)int i_Nation),
Datatype (from wxDB) (int I_dbDataType),
Datatype (from SQL) (SWORD i_sqlDataType),

int Format(int Nation, int dbDataType,SWORD sqlDataType,short columnSize,short decimalDigits);
The Formatted Objects receive Standard Values and Format() is called.
The Programmers can, if they want something special , change these Values and call Format() again

This class is most definitely very much underdeveloped ! It was made so that the DBGrid could be realised. Changes here are probable. (Suggestions welcomed)

Well now, that makes everything clear does't it?