コード例 #1
0
ファイル: SQLInstallerError.c プロジェクト: dancparkes/iODBC
RETCODE INSTAPI
SQLInstallerErrorW (WORD iError, DWORD * pfErrorCode, LPWSTR lpszErrorMsg,
    WORD cbErrorMsgMax, WORD * pcbErrorMsg)
{
  char *_errormsg_u8 = NULL;
  RETCODE retcode = SQL_ERROR;

  if (cbErrorMsgMax > 0)
    {
      if ((_errormsg_u8 =
	      malloc (cbErrorMsgMax * UTF8_MAX_CHAR_LEN + 1)) == NULL)
	{
	  PUSH_ERROR (ODBC_ERROR_OUT_OF_MEM);
	  goto done;
	}
    }

  retcode =
      SQLInstallerError (iError, pfErrorCode, _errormsg_u8,
      cbErrorMsgMax * UTF8_MAX_CHAR_LEN, pcbErrorMsg);

  if (retcode != SQL_ERROR)
    {
      dm_StrCopyOut2_U8toW (_errormsg_u8, lpszErrorMsg, cbErrorMsgMax,
	  pcbErrorMsg);
    }

done:
  MEM_FREE (_errormsg_u8);

  return retcode;
}
コード例 #2
0
BOOL INSTAPI
SQLInstallDriverManagerW (LPWSTR lpszPath, WORD cbPathMax,
    WORD FAR * pcbPathOut)
{
  char *_path_u8 = NULL;
  BOOL retcode = FALSE;

  if (cbPathMax > 0)
    {
      if ((_path_u8 = malloc (cbPathMax * UTF8_MAX_CHAR_LEN + 1)) == NULL)
	{
	  PUSH_ERROR (ODBC_ERROR_OUT_OF_MEM);
	  goto done;
	}
    }

  retcode =
      SQLInstallDriverManager (_path_u8, cbPathMax * UTF8_MAX_CHAR_LEN,
      pcbPathOut);

  if (retcode == TRUE)
    {
      dm_StrCopyOut2_U8toW (_path_u8, lpszPath, cbPathMax, pcbPathOut);
    }

done:
  MEM_FREE (_path_u8);

  return retcode;
}
コード例 #3
0
ファイル: SQLGetTranslator.c プロジェクト: openlink/iODBC
BOOL INSTAPI
SQLGetTranslatorW (HWND hwnd,
    LPWSTR lpszName,
    WORD cbNameMax,
    WORD FAR * pcbNameOut,
    LPWSTR lpszPath,
    WORD cbPathMax, WORD FAR * pcbPathOut, DWORD FAR * pvOption)
{
  char *_name_u8 = NULL;
  char *_path_u8 = NULL;
  BOOL retcode = FALSE;

  if (cbNameMax > 0)
    {
      if ((_name_u8 = malloc (cbNameMax * UTF8_MAX_CHAR_LEN + 1)) == NULL)
	{
	  PUSH_ERROR (ODBC_ERROR_OUT_OF_MEM);
	  goto done;
	}
    }

  if (cbPathMax > 0)
    {
      if ((_path_u8 = malloc (cbPathMax * UTF8_MAX_CHAR_LEN + 1)) == NULL)
	{
	  PUSH_ERROR (ODBC_ERROR_OUT_OF_MEM);
	  goto done;
	}
    }

  retcode =
      SQLGetTranslator (hwnd, _name_u8, cbNameMax * UTF8_MAX_CHAR_LEN,
      pcbNameOut, _path_u8, cbPathMax * UTF8_MAX_CHAR_LEN, pcbPathOut,
      pvOption);

  if (retcode == TRUE)
    {
      dm_StrCopyOut2_U8toW (_name_u8, lpszName, cbNameMax, pcbNameOut);
      dm_StrCopyOut2_U8toW (_path_u8, lpszPath, cbPathMax, pcbPathOut);
    }

done:
  MEM_FREE (_name_u8);
  MEM_FREE (_path_u8);

  return retcode;
}
コード例 #4
0
ファイル: SQLReadFileDSN.c プロジェクト: openlink/iODBC
BOOL INSTAPI
SQLReadFileDSNW (LPCWSTR lpszFileName, LPCWSTR lpszAppName,
                 LPCWSTR lpszKeyName, LPWSTR lpszString, WORD cbString, WORD * pcbString)
{
    char *_filename_u8 = NULL;
    char *_appname_u8 = NULL;
    char *_keyname_u8 = NULL;
    char *_string_u8 = NULL;
    BOOL retcode = FALSE;

    _filename_u8 = (char *) dm_SQL_WtoU8 ((SQLWCHAR *) lpszFileName, SQL_NTS);
    if (_filename_u8 == NULL && lpszFileName)
    {
        PUSH_ERROR (ODBC_ERROR_OUT_OF_MEM);
        goto done;
    }

    _appname_u8 = (char *) dm_SQL_WtoU8 ((SQLWCHAR *) lpszAppName, SQL_NTS);
    if (_appname_u8 == NULL && lpszAppName)
    {
        PUSH_ERROR (ODBC_ERROR_OUT_OF_MEM);
        goto done;
    }

    _keyname_u8 = (char *) dm_SQL_WtoU8 ((SQLWCHAR *) lpszKeyName, SQL_NTS);
    if (_keyname_u8 == NULL && lpszKeyName)
    {
        PUSH_ERROR (ODBC_ERROR_OUT_OF_MEM);
        goto done;
    }

    if (cbString > 0)
    {
        if ((_string_u8 = malloc (cbString * UTF8_MAX_CHAR_LEN + 1)) == NULL)
        {
            PUSH_ERROR (ODBC_ERROR_OUT_OF_MEM);
            goto done;
        }
    }

    retcode =
        SQLReadFileDSN (_filename_u8, _appname_u8, _keyname_u8, _string_u8,
                        cbString * UTF8_MAX_CHAR_LEN, pcbString);

    if (retcode == TRUE)
    {
        dm_StrCopyOut2_U8toW (_string_u8, lpszString, cbString, pcbString);
    }

done:
    MEM_FREE (_filename_u8);
    MEM_FREE (_appname_u8);
    MEM_FREE (_keyname_u8);
    MEM_FREE (_string_u8);

    return retcode;
}
コード例 #5
0
BOOL INSTAPI
SQLGetAvailableDriversW (LPCWSTR lpszInfFile, LPWSTR lpszBuf, WORD cbBufMax,
    WORD FAR * pcbBufOut)
{
  BOOL retcode = FALSE;
  char *_inf_u8 = NULL;
  char *_buffer_u8 = NULL;
  SQLCHAR *ptr;
  SQLWCHAR *ptrW;
  WORD len = 0, length;

  _inf_u8 = (char *) dm_SQL_WtoU8 ((SQLWCHAR *) lpszInfFile, SQL_NTS);
  if (_inf_u8 == NULL && lpszInfFile)
    {
      PUSH_ERROR (ODBC_ERROR_OUT_OF_MEM);
      goto done;
    }

  if (cbBufMax > 0)
    {
      if ((_buffer_u8 = malloc (cbBufMax * UTF8_MAX_CHAR_LEN + 1)) == NULL)
	{
	  PUSH_ERROR (ODBC_ERROR_OUT_OF_MEM);
	  goto done;
	}
    }

  retcode =
      SQLGetAvailableDrivers (_inf_u8, _buffer_u8,
      cbBufMax * UTF8_MAX_CHAR_LEN, pcbBufOut);

  if (retcode == TRUE)
    {
      length = 0;

      for (ptr = _buffer_u8, ptrW = lpszBuf; *ptr;
	  ptr += STRLEN (ptr) + 1, ptrW += WCSLEN (ptrW) + 1)
	{
	  dm_StrCopyOut2_U8toW (ptr, ptrW, cbBufMax - 1, &len);
	  length += len;
	}

      *ptrW = L'\0';
      if (pcbBufOut)
	*pcbBufOut = length + 1;
    }

done:
  MEM_FREE (_inf_u8);
  MEM_FREE (_buffer_u8);

  return retcode;
}
コード例 #6
0
BOOL INSTAPI
SQLInstallTranslatorExW (LPCWSTR lpszTranslator, LPCWSTR lpszPathIn,
    LPWSTR lpszPathOut, WORD cbPathOutMax, WORD * pcbPathOut, WORD fRequest,
    LPDWORD lpdwUsageCount)
{
  char *_translator_u8 = NULL;
  char *_pathin_u8 = NULL;
  char *_pathout_u8 = NULL;
  BOOL retcode = FALSE;
  int length;
  SQLWCHAR *ptr;
  char *ptr_u8;

  for (length = 0, ptr = (SQLWCHAR *) lpszTranslator; *ptr;
      length += WCSLEN (ptr) + 1, ptr += WCSLEN (ptr) + 1);

  if (length > 0)
    {
      if ((_translator_u8 = malloc (length * UTF8_MAX_CHAR_LEN + 1)) != NULL)
	{
	  for (ptr = (SQLWCHAR *) lpszTranslator, ptr_u8 = _translator_u8;
	      *ptr; ptr += WCSLEN (ptr) + 1, ptr_u8 += STRLEN (ptr_u8) + 1)
	    dm_StrCopyOut2_W2A (ptr, ptr_u8, WCSLEN (ptr) * UTF8_MAX_CHAR_LEN,
		NULL);
	  *ptr_u8 = '\0';
	}
    }
  else
    _translator_u8 =
	(char *) dm_SQL_WtoU8 ((SQLWCHAR *) lpszTranslator, SQL_NTS);

  if (_translator_u8 == NULL && lpszTranslator)
    {
      PUSH_ERROR (ODBC_ERROR_OUT_OF_MEM);
      goto done;
    }

  _pathin_u8 = (char *) dm_SQL_WtoU8 ((SQLWCHAR *) lpszPathIn, SQL_NTS);
  if (_pathin_u8 == NULL && lpszPathIn)
    {
      PUSH_ERROR (ODBC_ERROR_OUT_OF_MEM);
      goto done;
    }

  if (cbPathOutMax > 0)
    {
      if ((_pathout_u8 =
	      malloc (cbPathOutMax * UTF8_MAX_CHAR_LEN + 1)) == NULL)
	{
	  PUSH_ERROR (ODBC_ERROR_OUT_OF_MEM);
	  goto done;
	}
    }

  retcode = SQLInstallTranslatorEx (_translator_u8, _pathin_u8,
      _pathout_u8, cbPathOutMax * UTF8_MAX_CHAR_LEN, pcbPathOut, fRequest,
      lpdwUsageCount);

  if (retcode == TRUE)
    {
      dm_StrCopyOut2_U8toW (_pathout_u8, lpszPathOut, cbPathOutMax,
	  pcbPathOut);
    }

done:
  MEM_FREE (_translator_u8);
  MEM_FREE (_pathin_u8);
  MEM_FREE (_pathout_u8);

  return retcode;
}
コード例 #7
0
BOOL INSTAPI
SQLInstallTranslatorW (LPCWSTR lpszInfFile, LPCWSTR lpszTranslator,
    LPCWSTR lpszPathIn, LPWSTR lpszPathOut, WORD cbPathOutMax,
    WORD FAR * pcbPathOut, WORD fRequest, LPDWORD lpdwUsageCount)
{
  char *_inf_u8 = NULL;
  char *_translator_u8 = NULL;
  char *_pathin_u8 = NULL;
  char *_pathout_u8 = NULL;
  BOOL retcode = FALSE;

  _inf_u8 = (char *) dm_SQL_WtoU8 ((SQLWCHAR *) lpszInfFile, SQL_NTS);
  if (_inf_u8 == NULL && lpszInfFile)
    {
      PUSH_ERROR (ODBC_ERROR_OUT_OF_MEM);
      goto done;
    }

  _translator_u8 =
      (char *) dm_SQL_WtoU8 ((SQLWCHAR *) lpszTranslator, SQL_NTS);
  if (_translator_u8 == NULL && lpszTranslator)
    {
      PUSH_ERROR (ODBC_ERROR_OUT_OF_MEM);
      goto done;
    }

  _pathin_u8 = (char *) dm_SQL_WtoU8 ((SQLWCHAR *) lpszPathIn, SQL_NTS);
  if (_pathin_u8 == NULL && lpszPathIn)
    {
      PUSH_ERROR (ODBC_ERROR_OUT_OF_MEM);
      goto done;
    }

  if (cbPathOutMax > 0)
    {
      if ((_pathout_u8 =
	      malloc (cbPathOutMax * UTF8_MAX_CHAR_LEN + 1)) == NULL)
	{
	  PUSH_ERROR (ODBC_ERROR_OUT_OF_MEM);
	  goto done;
	}
    }

  retcode = SQLInstallTranslator (_inf_u8, _translator_u8, _pathin_u8,
      _pathout_u8, cbPathOutMax * UTF8_MAX_CHAR_LEN, pcbPathOut, fRequest,
      lpdwUsageCount);

  if (retcode == TRUE)
    {
      dm_StrCopyOut2_U8toW (_pathout_u8, lpszPathOut, cbPathOutMax,
	  pcbPathOut);
    }

done:
  MEM_FREE (_inf_u8);
  MEM_FREE (_translator_u8);
  MEM_FREE (_pathin_u8);
  MEM_FREE (_pathout_u8);

  return retcode;
}
コード例 #8
0
ファイル: info.c プロジェクト: angerangel/livecode-thirdparty
SQLRETURN SQL_API
SQLDriversW (SQLHENV henv,
    SQLUSMALLINT 	  fDir,
    SQLWCHAR		* szDrvDesc,
    SQLSMALLINT		  cbDrvDescMax,
    SQLSMALLINT		* pcbDrvDesc,
    SQLWCHAR		* szDrvAttr,
    SQLSMALLINT		  cbDrvAttrMax,
    SQLSMALLINT		* pcbDrvAttr)
{
  SQLCHAR *_Driver = NULL;  
  SQLCHAR *_Attrs = NULL;

  ENTER_HENV (henv,
    trace_SQLDriversW (TRACE_ENTER,
  	henv, 
	fDir, 
	szDrvDesc, cbDrvDescMax, pcbDrvDesc, 
	szDrvAttr, cbDrvAttrMax, pcbDrvAttr));

  if (cbDrvDescMax > 0)
    {
      if ((_Driver = (SQLCHAR *) malloc (cbDrvDescMax * UTF8_MAX_CHAR_LEN + 1)) == NULL)
	{
	  PUSHSQLERR (genv->herr, en_S1001);
	  return SQL_ERROR;
	}
    }

  if (cbDrvAttrMax > 0)
    {
      if ((_Attrs = (SQLCHAR *) malloc (cbDrvAttrMax * UTF8_MAX_CHAR_LEN + 1)) == NULL)
	{
	  PUSHSQLERR (genv->herr, en_S1001);
	  return SQL_ERROR;
	}
    }

  retcode = SQLDrivers_Internal (
  	henv, 
	fDir, 
	_Driver, cbDrvDescMax * UTF8_MAX_CHAR_LEN, pcbDrvDesc, 
	_Attrs, cbDrvAttrMax * UTF8_MAX_CHAR_LEN, pcbDrvAttr, 
	'W');

  if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)
    {
      dm_StrCopyOut2_U8toW (_Driver, szDrvDesc, cbDrvDescMax, pcbDrvDesc);
      dm_StrCopyOut2_U8toW (_Attrs, szDrvAttr, cbDrvAttrMax, pcbDrvAttr);
    }

  MEM_FREE (_Driver);
  MEM_FREE (_Attrs);

  LEAVE_HENV (henv,
    trace_SQLDriversW (TRACE_LEAVE,
  	henv, 
	fDir, 
	szDrvDesc, cbDrvDescMax, pcbDrvDesc, 
	szDrvAttr, cbDrvAttrMax, pcbDrvAttr));
}
コード例 #9
0
ファイル: info.c プロジェクト: angerangel/livecode-thirdparty
SQLRETURN SQL_API
SQLDataSourcesW (
  SQLHENV		  henv,
  SQLUSMALLINT		  fDir,
  SQLWCHAR 		* szDSN,
  SQLSMALLINT		  cbDSNMax,
  SQLSMALLINT 		* pcbDSN,
  SQLWCHAR 		* szDesc,
  SQLSMALLINT		  cbDescMax,
  SQLSMALLINT 		* pcbDesc)
{
  SQLCHAR *_DSN = NULL;  
  SQLCHAR *_Desc = NULL;

  ENTER_HENV (henv,
    trace_SQLDataSourcesW (TRACE_ENTER,
    	henv,
	fDir,
	szDSN, cbDSNMax, pcbDSN,
	szDesc, cbDescMax, pcbDesc));

  if (cbDSNMax > 0)
    {
      if ((_DSN = (SQLCHAR *) malloc (cbDSNMax * UTF8_MAX_CHAR_LEN + 1)) == NULL)
	{
	  PUSHSQLERR (genv->herr, en_S1001);
	  return SQL_ERROR;
	}
    }

  if (cbDescMax > 0)
    {
      if ((_Desc = (SQLCHAR *) malloc (cbDescMax * UTF8_MAX_CHAR_LEN + 1)) == NULL)
	{
	  PUSHSQLERR (genv->herr, en_S1001);
	  return SQL_ERROR;
	}
    }

  retcode = SQLDataSources_Internal (
  	henv, 
	fDir, 
	_DSN, cbDSNMax * UTF8_MAX_CHAR_LEN, pcbDSN, 
	_Desc, cbDescMax * UTF8_MAX_CHAR_LEN, pcbDesc, 
	'W');

  if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)
    {
      dm_StrCopyOut2_U8toW (_DSN, szDSN, cbDSNMax, pcbDSN);
      dm_StrCopyOut2_U8toW (_Desc, szDesc, cbDescMax, pcbDesc);
    }

  MEM_FREE (_DSN);
  MEM_FREE (_Desc);

  LEAVE_HENV (henv,
    trace_SQLDataSourcesW (TRACE_LEAVE,
    	henv,
	fDir,
	szDSN, cbDSNMax, pcbDSN,
	szDesc, cbDescMax, pcbDesc));
}