oracle中os命令大全,Oracle中如何直接运行OS命令(下)

EXEC SQL WHENEVER SQLERROR CONTINUE;

sqlglm(msg_buffer, &buffer_size, &msg_length);

printf("Daemon error while connecting:");

printf("%.*s", msg_length, msg_buffer);

printf("Daemon quitting.");

exit(1);

}

织梦好,好织梦

void

sql_error()

{

char msg_buffer[512];

int msg_length;

int buffer_size = 512;

织梦好,好织梦

EXEC SQL WHENEVER SQLERROR CONTINUE;

sqlglm(msg_buffer, &buffer_size, &msg_length);

printf("Daemon error while executing:");

printf("%.*s", msg_length, msg_buffer);

printf("Daemon continuing.");

}

main()

{

EXEC SQL WHENEVER SQLERROR DO connect_error();

EXEC SQL CONNECT :uid;

printf("Daemon connected.");

织梦内容管理系统

EXEC SQL WHENEVER SQLERROR DO sql_error();

printf("Daemon waiting...");

while (1) {

EXEC SQL EXECUTE

BEGIN

/*接收deamon发来的字符*/

:status := DBMS_PIPE.RECEIVE_MESSAGE('daemon');

IF :status = 0 THEN

/*取出字符*/

DBMS_PIPE.UNPACK_MESSAGE(:command);

END IF;

END;

END-EXEC;

IF (status == 0)

{

command.arr[command.len] = '\0';

/*如果是stop,该进程就退出*/

IF (!strcmp((char *) command.arr, "STOP"))

{

printf("Daemon exiting.");

break;

}

内容来自dedecms

ELSE IF (!strcmp((char *) command.arr, "SYSTEM"))

{

EXEC SQL EXECUTE

BEGIN

DBMS_PIPE.UNPACK_MESSAGE(:return_name);

DBMS_PIPE.UNPACK_MESSAGE(:value);

END;

END-EXEC;

value.arr[value.len] = '\0';

printf("Will execute system command '%s'", value.arr);

/*运行os命令*/

status = system(value.arr);

EXEC SQL EXECUTE

BEGIN

DBMS_PIPE.PACK_MESSAGE('done');

DBMS_PIPE.PACK_MESSAGE(:status);

:status := DBMS_PIPE.SEND_MESSAGE(:return_name);

END;

END-EXEC;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值