本文整理汇总了C#中IConfig.get方法的典型用法代码示例。如果您正苦于以下问题:C# IConfig.get方法的具体用法?C# IConfig.get怎么用?C# IConfig.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IConfig
的用法示例。
在下文中一共展示了IConfig.get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: client_parms
/*
** Name: client_parms
**
** Description:
** Process driver connection properties and send DAM-ML
** connection parameters.
**
** Input:
** config Configuration properties.
**
** Output:
** None.
**
** Returns:
** void.
**
** History:
** 17-Sep-99 (rajus01)
** Added connection parameters.
** 22-Sep-99 (gordy)
** Convert user/password to server character set when encrypting.
** 17-Jan-00 (gordy)
** Connection pool parameter sent as boolean value. No longer
** need to turn on autocommit since it is the default state for
** the server.
** 19-May-00 (gordy)
** Check for select loops connection parameter (internal) and
** set the DB connection state appropriatly.
** 30-Aug-00 (gordy)
** BUG #102472 - Fix the exception returned if user ID or
** password are zero-length strings. A zero-length string
** was not being caught by the null test and was causing an
** array exception during the password encoding. This was
** caught by intermediate code and turned into a 'character
** encoding' exception. Now, null and zero-length valued
** parameters are skipped, which for user ID and password
** result in a reasonably specific error from the server.
** 17-Oct-00 (gordy)
** Added autocommit mode connection parameter.
** 20-Jan-01 (gordy)
** Autocommit mode only supported at protocol level 2 or higher.
** 28-Mar-01 (gordy)
** Separated from constructor.
** 20-Aug-01 (gordy)
** Added connection parameter for default cursor mode.
** 01-Oct-02 (wansh01)
** Added support for MSG_CP_LOGIN_TYPE as a connection parameter.
** 31-Oct-02 (gordy)
** Extracted from connect().
** 23-Dec-02 (gordy)
** Check protocol level for login type. Added (no-op) CHAR_ENCODE.
** 18-Feb-03 (gordy)
** Property login type changed to vnode usage and changed values:
** LOCAL -> LOGIN, REMOTE -> CONNECT. Message parameter unchanged.
** 7-Jul-03 (gordy)
** Add Ingres configuration parameters. Changed properties
** parameter to support config heirarchy.
** 6-jul-04 (gordy; ported by thoda04)
** Added session_mask to password encryption.
** 27-feb-07 (thoda04)
** Add char_encoding support.
** 24-jul-07 (thoda04)
** Write the role password along with the roleID.
*/
private void client_parms( IConfig config )
{
byte i1;
if (trace.enabled(2))
trace.write(tr_id + ": sending connection parameters" );
/*
** Send connection request and parameters.
*/
if (trace.enabled(3))
trace.write(tr_id + ": sending connection parameters");
for (int i = 0; i < DrvConst.propInfo.Length; i++)
{
string propinfo = DrvConst.propInfo[i].name;
string stringValue = config.get(propinfo);
if (stringValue == null || stringValue.Length == 0)
continue;
// System.Windows.Forms.MessageBox.Show(
// propinfo + "=" + stringValue, "Parms Debug",
// System.Windows.Forms.MessageBoxButtons.OK,
// System.Windows.Forms.MessageBoxIcon.Information,
// System.Windows.Forms.MessageBoxDefaultButton.Button1,
// System.Windows.Forms.MessageBoxOptions.ServiceNotification);
switch (DrvConst.propInfo[i].msgID)
{
case MSG_CP_DATABASE:
database = stringValue;
msg.write(DrvConst.propInfo[i].msgID);
msg.write(stringValue);
break;
case MSG_CP_PASSWORD:
//.........这里部分代码省略.........
示例2: dbms_connect
/*
** Name: dbms_connect
**
** Description:
** Establish connection with DBMS.
**
** Input:
** info Connection property list.
** xid Distributed transaction ID.
** timeout Connection timeout.
**
** Output:
** None.
**
** Returns:
** void.
**
** History:
** 28-Mar-01 (gordy)
** Separated from constructor.
** 11-Apr-01 (gordy)
** Added timeout parameter to replace DriverManager reference.
** 18-Apr-01 (gordy)
** Added support for Distributed Transaction Management Connections.
** 10-May-01 (gordy)
** Check DBMS capabilities relevant to driver configuration.
** 20-Aug-01 (gordy)
** Added connection parameter for default cursor mode.
** 20-Feb-02 (gordy)
** Added dbmsInfo checks for DBMS type and protocol level.
** 1-Mar-07 (gordy, ported by thoda04)
** Check connection character encoding and property override.
*/
private void dbms_connect(IConfig config, int timeout, AdvanXID xa_xid)
{
/*
** Check if character encoding has been established
** for the connection. If not, it may be explicitly
** set via driver properties. Encoding must be set
** before connection parameters are processed.
*/
String encodingName = config.get(DrvConst.DRV_PROP_ENCODE);
if (encodingName != null && encodingName.Length != 0)
{
// encodingName was checked to be valid in ParseConnectionString
System.Text.Encoding encoding =
System.Text.Encoding.GetEncoding(encodingName);
try
{
msg.setCharSet(
new CharSet(encoding, true, "CharacterEncoding", encodingName));
if (trace.enabled(1))
trace.write(tr_id + ": encoding: " +
encodingName + " (" + encoding.ToString() +
",WindowsCodePage=" + encoding.WindowsCodePage.ToString()
+ ")");
}
catch (Exception)
{
if (trace.enabled(1))
trace.write(tr_id + ": unknown encoding: " + encodingName);
throw SqlEx.get(ERR_GC4009_BAD_CHARSET);
}
}
else if (msg.getCharSet() == null)
{
if (trace.enabled())
trace.log(title + ": failed to establish character encoding!");
throw SqlEx.get(ERR_GC4009_BAD_CHARSET);
}
if (trace.enabled(2))
trace.write(tr_id + ": Connecting to database");
try
{
/*
** Send connection request and parameters.
*/
msg.begin(MSG_CONNECT);
client_parms ( config );
driver_parms( checkLocalUser( config ), timeout, xa_xid );
msg.done( true );
readResults();
}
catch ( SqlEx ex )
{
if (trace.enabled(1))
trace.write(tr_id + ": error connecting to database:" +
ex.Message);
conn.close();
throw;
}
}
示例3: checkLocalUser
/*
** Name: checkLocalUser
**
** Description:
** Check to see if local user ID should be used to establish DBMS
** connection. Any application provided user ID is used instead.
** The connection must be to a local server and not DTMC.
**
** Input:
** config Configuration properties.
**
** Output:
** None.
**
** Returns:
** boolean TRUE if local user ID should be used, FALSE otherwise.
**
** History:
** 31-Oct-02 (wansh01)
** Created.
** 23-Dec-02 (gordy)
** Check protocol level.
** 7-Jul-03 (gordy)
** Changed properties parameter to support config heirarchy.
** Connection parameters now set in driver_parms. Don't need
** to see if local user ID is accessible, it will be handled
** when trying to send the user ID.
*/
private bool checkLocalUser( IConfig config )
{
String userID;
return( msg.isLocal() && ! conn.is_dtmc &&
conn.msg_protocol_level >= MSG_PROTO_3 &&
( (userID = config.get( DrvConst.DRV_PROP_USR )) == null ||
userID.Length == 0 ) );
}