⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ocilib_demo.h

📁 ORACLE编程的好东西,纯C写的OCI封装.很好用,支持数据池.
💻 H
字号:
/*
   +----------------------------------------------------------------------+   
   |                                                                      |
   |                     OCILIB - C Driver for Oracle                     |
   |                                                                      |
   |                      (C Wrapper for Oracle OCI)                      |
   |                                                                      |
   |                         DEMO HEADER FILE                             |
   |                                                                      |
   +----------------------------------------------------------------------+
   |              Website : http://orclib.sourceforge.net                 |
   +----------------------------------------------------------------------+
   |               Copyright (c) 2007-2008 Vincent ROGIER                 |
   +----------------------------------------------------------------------+
   | This library is free software; you can redistribute it and/or        |
   | modify it under the terms of the GNU Library General Public          |
   | License as published by the Free Software Foundation; either         |
   | version 2 of the License, or (at your option) any later version.     |
   |                                                                      |
   | This library is distributed in the hope that it will be useful,      |
   | but WITHOUT ANY WARRANTY; without even the implied warranty of       |
   | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU    |
   | Library General Public License for more details.                     |
   |                                                                      |
   | You should have received a copy of the GNU Library General Public    |
   | License along with this library; if not, write to the Free           |
   | Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.   |
   +----------------------------------------------------------------------+
   |          Author: Vincent ROGIER <vince.rogier@gmail.com>             |
   +----------------------------------------------------------------------+ 
*/

/* ------------------------------------------------------------------------ *
 *
 * THIS DEMO RUNS ON ALL PLATFOMS AND OCILIB BUILDS. 
 *
 * SO, WE NEED A LITTLE EFFORT TO KEEP THE SAME SOURCE CODE FOR :
 *
 *    - MS WINDOWS AND UNIXES
 *    - ANSI / MIXED / UNICODE BUILDS
 *
 * SOME DEFINES FOLLOW IN ORDER TO HANDLE ALL THOSE STUFF
 *
 * ------------------------------------------------------------------------ */

/* ------------------------------------------------------------------------ *
 * COMMON DEFINES
 * ------------------------------------------------------------------------ */

#define ARG_DB     1
#define ARG_USER   2
#define ARG_PWD    3
#define ARG_HOME   4

#define ARG_COUNT  5

#define SIZE_STR   260
#define SIZE_BUF   2048
#define SIZE_TAB   5

/* ------------------------------------------------------------------------ *
 * PlATFORMS
 * ------------------------------------------------------------------------ */

#ifdef _WINDOWS   
    #include "windows.h"
#endif

/* ------------------------------------------------------------------------ *
 * INCLUDES
 * ------------------------------------------------------------------------ */

#include <ocilib.h>

/* ------------------------------------------------------------------------ *
 * PlATFORMS
 * ------------------------------------------------------------------------ */

#ifdef _MSC_VER
    
    #if defined(OCI_CHARSET_UNICODE)
        #pragma comment(lib, "ocilibw.lib") 
    #elif defined(OCI_CHARSET_MIXED)
        #pragma comment(lib, "ocilibm.lib") 
    #elif defined(OCI_CHARSET_ANSI)
        #pragma comment(lib, "ociliba.lib") 
    #endif

#endif


#ifdef _WINDOWS  
   #define EXE_NAME   "ocilib_demo.exe"
#else
   #define EXE_NAME   "ocilib_demo"
#endif

/* ------------------------------------------------------------------------ *
 * STRING PRINTING
 * ------------------------------------------------------------------------ */

#define print_text(x)       printf(x)
#define print_frmt(f, x)    printf(f, x)

#if defined(OCI_CHARSET_UNICODE)

    #define print_mt  wprintf
    #define print_dt  wprintf
    #define sprint_mt swprintf
    #define sprint_dt swprintf
    #define dtslen    wcslen

#elif defined(OCI_CHARSET_MIXED)

    #define print_mt  printf
    #define print_dt  wprintf
    #define sprint_mt ocisprintf
    #define sprint_dt swprintf
    #define dtslen    wcslen

#else

    #define print_mt  printf
    #define print_dt  printf
    #define sprint_mt ocisprintf
    #define sprint_dt ocisprintf
    #define dtslen    strlen

#endif

/* print userdata text */

#if !defined(OCI_CHARSET_ANSI) && !defined(_WINDOWS)

    #define print_dstr(x)   print_dt(DT("%ls"), x)

#else

    #define print_dstr(x)   print_dt(DT("%s"), x)

#endif

/* print metadata text */

#if defined(OCI_CHARSET_UNICODE) && !defined(_WINDOWS)

    #define print_mstr(x)   print_mt(MT("%ls"), x)

#else

    #define print_mstr(x)   print_mt(MT("%s"), x)

#endif 

/* ------------------------------------------------------------------------ *
 * PROGRAM ARGUMENTS
 * ------------------------------------------------------------------------ */

#if defined(_WINDOWS) && defined(OCI_CHARSET_UNICODE)

    #define mtmain          wmain
    #define mtarg           mtext
    #define print_args(x)   print_mt(x)

#else

    #define mtmain          main
    #define mtarg           char
    #define print_args(x)   print_text(x)

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -