dbserv.cpp.bak

来自「TUXEDO连接数据库的例子」· BAK 代码 · 共 75 行

BAK
75
字号
/*	(c) 2003 BEA Systems, Inc. All Rights Reserved. */
/*	Copyright (c) 1997 BEA Systems, Inc.
  	All rights reserved

  	THIS IS UNPUBLISHED PROPRIETARY
  	SOURCE CODE OF BEA Systems, Inc.
  	The copyright notice above does not
  	evidence any actual or intended
  	publication of such source code.
*/

/* #ident	"@(#) samples/atmi/simpapp/simpserv.c	$Revision: 1.5 $" */

#include <stdio.h>
#include <ctype.h>
#include <atmi.h>	/* TUXEDO Header File */
#include <userlog.h>	/* TUXEDO Header File */

#include <userlog.h>

#include "db.h"

#pragma comment( lib, "oci" )

/* tpsvrinit is executed when a server is booted, before it begins
   processing requests.  It is not necessary to have this function.
   Also available is tpsvrdone (not used in this example), which is
   called at server shutdown time.
*/

#if defined(__STDC__) || defined(__cplusplus)
tpsvrinit(int argc, char *argv[])
#else
tpsvrinit(argc, argv)
int argc;
char **argv;
#endif
{
	/* Some compilers warn if argc and argv aren't used. */
	argc = argc;
	argv = argv;

	/* userlog writes to the central TUXEDO message log */
	userlog("Welcome to the simple server");
	return(0);
}

/* This function performs the actual service requested by the client.
   Its argument is a structure containing among other things a pointer
   to the data buffer, and the length of the data buffer.
*/

#ifdef __cplusplus
extern "C"
#endif
void
#if defined(__STDC__) || defined(__cplusplus)
DBCONNECT(TPSVCINFO *rqst)
#else
DBCONNECT(rqst)
TPSVCINFO *rqst;
#endif
{
	CDbOracleDriver  conn;
	bool xu;
	
	conn.Init();
	xu=conn.OpenConnection("cncnms.irwin","cncnms","cncnms",23,"server1");
	userlog("xu:%d",xu);
	conn.ExecuteSQL("insert into XUTEST(ID,NAME) values(412,'xuhao')");
	conn.CloseConnection();
	
	tpreturn(TPSUCCESS, 0, rqst->data, 0L, 0);
}

⌨️ 快捷键说明

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