Skip to content

Latest commit

 

History

History
98 lines (76 loc) · 4.65 KB

sqlgettranslator-function.md

File metadata and controls

98 lines (76 loc) · 4.65 KB
titledescriptionauthorms.authorms.datems.servicems.subservicems.topicf1_keywordshelpviewer_keywordsapilocationapinameapitype
SQLGetTranslator Function
SQLGetTranslator Function
David-Engel
davidengel
01/19/2017
sql
connectivity
reference
SQLGetTranslator
SQLGetTranslator function [ODBC]
sqlsrv32.dll
SQLGetTranslator
dllExport

SQLGetTranslator Function

Conformance
Version Introduced: ODBC 2.0

Summary
SQLGetTranslator displays a dialog box from which a user can select a translator.

Syntax

 BOOL SQLGetTranslator( HWND hwndParent, LPSTR lpszName, WORD cbNameMax, WORD * pcbNameOut, LPSTR lpszPath, WORD cbPathMax, WORD * pcbPathOut, DWORD * pvOption); 

Arguments

hwndParent
[Input] Parent window handle.

lpszName
[Input/Output] Name of the translator from the system information.

cbNameMax
[Input] Maximum length of the lpszName buffer.

pcbNameOut
[Input/Output] Total number of bytes (excluding the null-termination byte) passed or returned in lpszName. If the number of bytes available to return is greater than or equal to cbNameMax, the translator name in lpszName is truncated to cbNameMax minus the null-termination character. The pcbNameOut argument can be a null pointer.

lpszPath
[Output] Full path of the translation DLL.

cbPathMax
[Input] Maximum length of the lpszPath buffer.

pcbPathOut
[Output] Total number of bytes (excluding the null-termination byte) returned in lpszPath. If the number of bytes available to return is greater than or equal to cbPathMax, the translation DLL path in lpszPath is truncated to cbPathMax minus the null-termination character. The pcbPathOut argument can be a null pointer.

pvOption
[Output] 32-bit translation option.

Returns

The function returns TRUE if it is successful, FALSE if it fails or if the user cancels the dialog box.

Diagnostics

When SQLGetTranslator returns FALSE, an associated *pfErrorCode value can be obtained by calling SQLInstallerError. The following table lists the *pfErrorCode values that can be returned by SQLInstallerError and explains each one in the context of this function.

*pfErrorCodeErrorDescription
ODBC_ERROR_GENERAL_ERRGeneral installer errorAn error occurred for which there was no specific installer error.
ODBC_ERROR_INVALID_BUFF_LENInvalid buffer lengthThe cbNameMax or cbPathMax argument was less than or equal to 0.
ODBC_ERROR_INVALID_HWNDInvalid window handleThe hwndParent argument was invalid or NULL.
ODBC_ERROR_INVALID_NAMEInvalid driver or translator nameThe lpszName argument was invalid. It could not be found in the registry.
ODBC_ERROR_LOAD_LIBRARY_FAILEDCould not load the driver or translator setup libraryThe translator library could not be loaded.
ODBC_ERROR_INVALID_OPTIONInvalid transaction optionThe pvOption argument contained an invalid value.
ODBC_ERROR_OUT_OF_MEMOut of memoryThe installer could not perform the function because of a lack of memory.

Comments

If hwndParent is null or if lpszName, lpszPath, or pvOption is a null pointer, SQLGetTranslator returns FALSE. Otherwise, it displays the list of installed translators in the following dialog box.

Select Translator dialog box

If lpszName contains a valid translator name, it is selected. Otherwise, <No Translator> is selected.

If the user chooses <No Translator>, the contents of lpszName, lpszPath, and pvOption are not touched. SQLGetTranslator sets pcbNameOut and pcbPathOut to 0 and returns TRUE.

If the user chooses a translator, SQLGetTranslator calls ConfigTranslator in the translator's setup DLL. If ConfigTranslator returns FALSE, SQLGetTranslator returns to its dialog box. If ConfigTranslator returns TRUE, SQLGetTranslator returns TRUE, along with the selected translator name, path, and translation option.

Related Functions

For information aboutSee
Configuring a translatorConfigTranslator
Getting a translation attributeSQLGetConnectAttr
Setting a translation attributeSQLSetConnectAttr
close