Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
1.9 KiB

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1999, Microsoft Corp. All rights reserved.
  4. //
  5. // FILE
  6. //
  7. // helper.cpp
  8. //
  9. // SYNOPSIS
  10. //
  11. // Helper functions: log file, string conversion
  12. //
  13. // MODIFICATION HISTORY
  14. //
  15. // 01/25/1999 Original version. Thierry Perraut
  16. //
  17. ///////////////////////////////////////////////////////////////////////////////
  18. #include "precomp.hpp"
  19. #include "SimpleTableEx.h"
  20. //////////////////////////////////////////////////////////////////////////////
  21. //
  22. // TracePrintf: trace function
  23. //
  24. //////////////////////////////////////////////////////////////////////////////
  25. void
  26. __cdecl
  27. TracePrintf(
  28. IN PCSTR szFormat,
  29. ...
  30. )
  31. {
  32. va_list marker;
  33. va_start(marker, szFormat);
  34. vprintf(
  35. szFormat,
  36. marker
  37. );
  38. va_end(marker);
  39. }
  40. //////////////////////////////////////////////////////////////////////////////
  41. //
  42. // TraceString: trace function
  43. //
  44. //////////////////////////////////////////////////////////////////////////////
  45. void TraceString(char* cString)
  46. {
  47. _ASSERTE(cString);
  48. printf("%s\n", cString);
  49. }
  50. // ///////////////////////////////////////////////////////////////////////////
  51. //
  52. // ConvertTypeStringToLong
  53. //
  54. //
  55. // ///////////////////////////////////////////////////////////////////////////
  56. HRESULT ConvertTypeStringToLong(const WCHAR *lColumnType, LONG *pType)
  57. {
  58. _ASSERTE(pType != NULL);
  59. HRESULT hres = S_OK;
  60. if(wcscmp(L"DBTYPE_I4",lColumnType) == 0)
  61. {
  62. *pType = DBTYPE_I4;
  63. }
  64. else if(wcscmp(L"DBTYPE_WSTR",lColumnType) == 0)
  65. {
  66. *pType = DBTYPE_WSTR;
  67. }
  68. else if(wcscmp(L"DBTYPE_BOOL",lColumnType) == 0)
  69. {
  70. *pType = DBTYPE_BOOL;
  71. }
  72. else
  73. {
  74. *pType = -1;
  75. hres = E_FAIL;
  76. }
  77. return hres;
  78. }