SQLCopyDesc.cpp
上传用户:romrleung
上传日期:2022-05-23
资源大小:18897k
文件大小:2k
源码类别:

MySQL数据库

开发平台:

Visual C++

  1. /* Copyright (C) 2003 MySQL AB
  2.    This program is free software; you can redistribute it and/or modify
  3.    it under the terms of the GNU General Public License as published by
  4.    the Free Software Foundation; either version 2 of the License, or
  5.    (at your option) any later version.
  6.    This program is distributed in the hope that it will be useful,
  7.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  8.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  9.    GNU General Public License for more details.
  10.    You should have received a copy of the GNU General Public License
  11.    along with this program; if not, write to the Free Software
  12.    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
  13. #include "driver.hpp"
  14. #if ODBCVER >= 0x0300
  15. SQLRETURN SQL_API
  16. SQLCopyDesc(
  17.     SQLHDESC SourceDescHandle,
  18.     SQLHDESC TargetDescHandle)
  19. {
  20. #ifndef auto_SQLCopyDesc
  21.     const char* const sqlFunction = "SQLCopyDesc";
  22.     Ctx ctx;
  23.     ctx_log1(("*** not implemented: %s", sqlFunction));
  24.     return SQL_ERROR;
  25. #else
  26.     driver_enter(SQL_API_SQLCOPYDESC);
  27.     const char* const sqlFunction = "SQLCopyDesc";
  28.     HandleRoot* const pRoot = HandleRoot::instance();
  29.     HandleDesc* pDesc = pRoot->findDesc(SourceDescHandle);
  30.     if (pDesc == 0) {
  31. driver_exit(SQL_API_SQLCOPYDESC);
  32.         return SQL_INVALID_HANDLE;
  33.     }
  34.     HandleDesc* pDesc = pRoot->findDesc(TargetDescHandle);
  35.     if (pDesc == 0) {
  36. driver_exit(SQL_API_SQLCOPYDESC);
  37.         return SQL_INVALID_HANDLE;
  38.     }
  39.     Ctx& ctx = *new Ctx;
  40.     ctx.logSqlEnter(sqlFunction);
  41.     if (ctx.ok())
  42.         pDesc->sqlCopyDesc(
  43.             ctx,
  44.             pDesc
  45.         );
  46.     pDesc->saveCtx(ctx);
  47.     ctx.logSqlExit();
  48.     SQLRETURN ret = ctx.getCode();
  49.     driver_exit(SQL_API_SQLCOPYDESC);
  50.     return ret;
  51. #endif
  52. }
  53. #endif // ODBCVER >= 0x0300