wxDbConnectInf

This class is used for holding the data necessary for connecting to the ODBC datasource. That information includes: SQL environment handle, datasource name, user ID, password and default directory path (used with dBase). Other optional fields held in this class are and file type, both for future functions planned to be added for creating/manipulating datasource definitions.



wxDbConnectInf::wxDbConnectInf



wxDbConnectInf(void)

Default constructor.



wxDbConnectInf(HENV henv, const wxString & dsn, const wxString & userID="", const wxString & password, const wxString & defaultDir="", const wxString & description="", const wxString & fileType="")

Constructor which allows initial settings of all the classes member variables.

See the special note below on the henv parameter for forcing this constructor to create a SQL environment handle automatically, rather than needing to pass one in to the function.

Parameters

henv
Environment handle used for this connection. See wxDConnectInf::AllocHenv for how to create an SQL environment handle. NOTE: Passing in a NULL for this parameter will inform the constructor that it should create its own SQL environment handle. If NULL is passed for this parameter, the constructor will call wxDConnectInf::AllocHenv internally. A flag is set internally also to indicate that the HENV was created by the constructor so that when the default class destructor is called, the destructor will call wxDConnectInf::FreeHenv to free the environment handle automatically.
dsn
Name of the datasource to be used in creating wxDb instances for creating connection(s) to a datasource.
userID
OPTIONAL Many datasources allow (or even require) use of a username to determine privileges that connecting user is allowed to have when accessing the datasource or the data tables. Default is "".
password
OPTIONAL Password to be associated with the user ID specified in 'userID'. Default is "".
defaultDir
OPTIONAL Used for datasources which require the path to where the data file is stored to be specified. dBase is one example of the type of datasource which requires this information. Default is "".
description
OPTIONAL FUTURE USE Default is "".
fileType
OPTIONAL FUTURE USE Default is "".

Remarks

It is strongly recommended that programs use the longer form of the constructor and allow the constructor to create the SQL environment handle automatically, and manage the destruction of the handle.

Example

   wxDbConnectInf *DbConnectInf;

	DbConnectInf = new wxDbConnectInf(0,"MY_DSN", "MY_USER", "MY_PASSWORD");

	....the rest of the program

	delete DbConnectInf;

See also

wxDConnectInf::AllocHenv, wxDConnectInf::FreeHenv



wxDbConnectInf::~wxDbConnectInf



~wxDbConnectInf()

Handles the default destruction of the instance of the class. If the long form of the wxDConnectInf was used, then this destructor also takes care of calling wxDConnectInf::FreeHenv to free the SQL environment handle.



wxDbConnectInf::AllocHenv



bool AllocHenv(void)

Allocates a SQL environment handle that will be used to interface with an ODBC datasource.

Remarks

This function can be automatically called by the long from of the wxDbConnectInf constructor.



wxDbConnectInf::FreeHenv



void FreeHenv(void)

Frees the SQL environment handle being managed by the instance of this class.

Remarks

If the SQL environment handle was created using the long form of the wxDbConnectInf constructor, then the flag indicating that the HENV should be destroyed when the classes destructor is called is reset to be false, so that any future handles created using the wxDbConnectInf::AllocHenv function must be manually released with a call to this function.



wxDbConnectInf::Initialize

Simply initializes all member variables to a cleared state. Called by the constructor automatically.



wxDbConnectInf::GetAuthStr



const wxChar * GetAuthStr(void)

Accessor function to return the password assigned for this class instance that will be used with the user ID.

Synonymous with wxDbConnectInf::GetPassword



wxDbConnectInf::GetDefaultDir



const wxChar * GetDefaultDir(void)

Accessor function to return the default directory in which the datasource's data table is stored. This directory is only used for file based datasources like dBase. MS-Access does not require this to be set, as the path is set in the ODBC Administrator for MS-Access.



wxDbConnectInf::GetDescription



const wxChar * GetDescription(void)

Accessor function to return the description assigned for this class instance.

NOTE: Description is a FUTURE USE item and is unused currently.



wxDbConnectInf::GetDsn



const wxChar * GetDsn(void)

Accessor function to return the datasource name assigned for this class instance.



wxDbConnectInf::GetFileType



const wxChar * GetFileType(void)

Accessor function to return the filetype of the ODBC datasource assigned for this class instance.

NOTE: FileType is a FUTURE USE item and is unused currently.



wxDbConnectInf::GetHenv



const HENV GetHenv(void)

Accessor function to return the SQL environment handle being managed by this class instance.



wxDbConnectInf::GetPassword



const wxChar * GetPassword(void)

Accessor function to return the password assigned for this class instance that will be used with the user ID.

Synonymous with wxDbConnectInf::GetAuthStr



wxDbConnectInf::GetUid



const wxChar * GetUid(void)

Accessor function to return the user ID assigned for this class instance.



wxDbConnectInf::GetUserID



const wxChar * GetUserID(void)

Accessor function to return the user ID assigned for this class instance.



wxDbConnectInf::SetAuthStr



void SetAuthStr(const wxString &authstr)

Accessor function to assign the password for this class instance that will be used with the user ID.

Synonymous with wxDbConnectInf::SetPassword



wxDbConnectInf::SetDefaultDir



void SetDefaultDir(const wxString &defDir)

Accessor function to assign the default directory in which the datasource's data table is stored. This directory is only used for file based datasources like dBase. MS-Access does not require this to be set, as the path is set in the ODBC Administrator for MS-Access.



wxDbConnectInf::SetDescription



void SetDescription(const wxString &desc)

Accessor function to assign the description assigned for this class instance.

NOTE: Description is a FUTURE USE item and is unused currently.



wxDbConnectInf::SetDsn



void SetDsn(const wxString &dsn)

Accessor function to assign the datasource name for this class instance.



wxDbConnectInf::SetFileType



void SetFileType(const wxString &)

Accessor function to return the filetype of the ODBC datasource assigned for this class instance.

NOTE: FileType is a FUTURE USE item and is unused currently.



wxDbConnectInf::SetHenv



void SetHenv(const HENV henv)

Accessor function to set the SQL environment handle for this class instance.



wxDbConnectInf::SetPassword



void SetPassword(const wxString &password)

Accessor function to assign the password for this class instance that will be used with the user ID.

Synonymous with wxDbConnectInf::SetAuthStr



wxDbConnectInf::SetUid



void SetUid(const wxString &uid)

Accessor function to set the user ID for this class instance.



wxDbConnectInf::SetUserID



void SetUserID(const wxString &userID)

Accessor function to assign the user ID for this class instance.

ymasuda 平成17年11月19日