void CDataSource::updateDSValues(short DSNType, CONNECT_FIELD_ITEMS *connectFieldItems,
								 CONNECT_KEYWORD_TREE *keywordTree)
{

	long	tempValue;
	char	AttrValue[256];
	short	i;

	if (DSNType == DRIVER_KW_DSN)
		m_DSName[0] = '\0';
	strcpy(m_DSServer, connectFieldItems->server);
	strcpy(m_DSCatalog, connectFieldItems->catalog);
	strcpy(m_DSSchema, connectFieldItems->schema);
	
	for (i = KEY_SCHEMA+1 ; i < KEY_MAX ; i++)
	{
		if (keywordTree[i].AttrRank != 0)
		{
			strncpy(AttrValue, keywordTree[i].AttrValue, keywordTree[i].AttrLength);
			AttrValue[keywordTree[i].AttrLength] = '\0';
			switch (i)
			{
			case KEY_CTRLINFERNCHAR:
				tempValue = atol(AttrValue);
				if (tempValue)
					m_DSCtrlInferNCHAR = TRUE;
				else
					m_DSCtrlInferNCHAR = FALSE;
				break;
			case KEY_DATALANG:
				m_DSDataLang = atol(keywordTree[KEY_DATALANG].AttrValue);
				ODBCNLS_ValidateLanguage((unsigned long*)&m_DSDataLang);
				break;
			case KEY_ERRORMSGLANG:
				m_DSErrorMsgLang = atol(AttrValue);
				ODBCNLS_ValidateLanguage((unsigned long*)&m_DSErrorMsgLang);
				break;
			case KEY_FETCHBUFFERSIZE:
				if (stricmp(AttrValue, SYSTEM_DEFAULT) == 0)
					m_DSFetchBufferSize = FETCH_BUFFER_SIZE_DEFAULT;
				else
					m_DSFetchBufferSize = atol(AttrValue);
				break;
			case KEY_SQL_ATTR_CONNECTION_TIMEOUT:
				if (stricmp(AttrValue, SYSTEM_DEFAULT) == 0)
					m_DSConnectionTimeout = CONNECTION_TIMEOUT_DEFAULT;
				else
					m_DSConnectionTimeout = atol(AttrValue);
				break;
			case KEY_SQL_LOGIN_TIMEOUT:
				if (stricmp(AttrValue, SYSTEM_DEFAULT) == 0)
					m_DSLoginTimeout = LOGIN_TIMEOUT_DEFAULT;
				else
					m_DSLoginTimeout = atol(AttrValue);
				break;
			case KEY_SQL_QUERY_TIMEOUT:
				if (stricmp(AttrValue, SYSTEM_DEFAULT) == 0)
					m_DSQueryTimeout = QUERY_TIMEOUT_DEFAULT;
				else
					m_DSQueryTimeout = atol(AttrValue);
			case KEY_TRANSLATIONDLL:
				strncpy(m_DSTranslationDLL, AttrValue, sizeof(m_DSTranslationDLL));
				m_DSTranslationDLL[sizeof(m_DSTranslationDLL)-1] = 0;
				break;
			case KEY_TRANSLATIONOPTION:
				m_DSTranslationOption = atol(AttrValue);
				break;
			case KEY_SDSN:
				strncpy(m_DSServerDSName, AttrValue, sizeof(m_DSServerDSName));
				m_DSServerDSName[sizeof(m_DSServerDSName)-1] = 0;
				break;
			case KEY_SN:
				strncpy(m_DSServiceName, AttrValue, sizeof(m_DSServiceName));
				m_DSServiceName[sizeof(m_DSServiceName)-1] = 0;
				break;
			case KEY_SESSION:
				strncpy(m_DSSession, AttrValue, sizeof(m_DSSession));
				m_DSSession[sizeof(m_DSSession)-1] = 0;
				break;
			case KEY_APPLICATION:
				strncpy(m_DSApplication, AttrValue, sizeof(m_DSApplication));
				m_DSApplication[sizeof(m_DSApplication)-1] = 0;
				break;
			case KEY_ROLENAME:
				strncpy(m_DSRoleName, AttrValue, sizeof(m_DSRoleName));
				m_DSRoleName[sizeof(m_DSRoleName)-1] = 0;
				break;
			case KEY_CERTIFICATEDIR:
				strncpy(m_DSCertificateDir, AttrValue, sizeof(m_DSCertificateDir));
				m_DSCertificateDir[sizeof(m_DSCertificateDir)-1] = 0;
				break;
			case KEY_CERTIFICATEFILE:
				strncpy(m_DSCertificateFile, AttrValue, sizeof(m_DSCertificateFile));
				m_DSCertificateFile[sizeof(m_DSCertificateFile)-1] = 0;
				break;
			case KEY_CERTIFICATEFILE_ACTIVE:
				strncpy(m_DSCertificateFileActive, AttrValue, sizeof(m_DSCertificateFileActive));
				m_DSCertificateFileActive[sizeof(m_DSCertificateFileActive)-1] = 0;
				break;

			default:
				break;
			}
		}
	}

}
Ejemplo n.º 2
0
void OdbcMsg::SetLanguageId (DWORD LanguageId)
{
	dwLanguageId = LanguageId;
	// set the internal language to something we handle
	ODBCNLS_ValidateLanguage (&dwLanguageId);
}