| 1 | /********************************************** |
|---|---|
| 2 | * SQLPostInstallerError |
| 3 | * |
| 4 | * Drivers can call me to let me know there was a |
| 5 | * problem. This can be retreived by the app using |
| 6 | * SQLInstallerError. |
| 7 | * |
| 8 | * Does not currently use szErrorMsg due to extreme |
| 9 | * limitations of logging here. This should be corrected. |
| 10 | * |
| 11 | ************************************************** |
| 12 | * This code was created by Peter Harvey @ CodeByDesign. |
| 13 | * Released under LGPL 28.JAN.99 |
| 14 | * |
| 15 | * Contributions from... |
| 16 | * ----------------------------------------------- |
| 17 | * Peter Harvey - pharvey@codebydesign.com |
| 18 | **************************************************/ |
| 19 | #include <config.h> |
| 20 | #include <odbcinstext.h> |
| 21 | |
| 22 | RETCODE SQLPostInstallerError( DWORD nErrorCode, |
| 23 | LPCSTR szErrorMsg ) |
| 24 | { |
| 25 | if ( nErrorCode > ODBC_ERROR_OUTPUT_STRING_TRUNCATED ) |
| 26 | return SQL_ERROR; |
| 27 | |
| 28 | inst_logPushMsg( __FILE__, __FILE__, __LINE__, LOG_CRITICAL, nErrorCode, (char *)szErrorMsg ); |
| 29 | |
| 30 | return SQL_SUCCESS; |
| 31 | } |
| 32 | |
| 33 | SQLRETURN INSTAPI SQLPostInstallerErrorW(DWORD dwErrorCode, |
| 34 | LPCWSTR lpszErrorMsg) |
| 35 | { |
| 36 | char *msg = lpszErrorMsg ? _single_string_alloc_and_copy( lpszErrorMsg ) : (char*)NULL; |
| 37 | SQLRETURN ret; |
| 38 | |
| 39 | ret = SQLPostInstallerError( dwErrorCode, msg ); |
| 40 | |
| 41 | if ( msg ) |
| 42 | free( msg ); |
| 43 | |
| 44 | return ret; |
| 45 | } |
| 46 |