_Rrollbck () -回滚落实控制更改
格式
#include <recio.h>
int _Rrollbck(void);语言级别
ILE C 扩展
线程安全
False
描述
_Rrollbck() 函数将最后一个落实边界重新建立为当前落实边界。 将撤销对作业中落实控制下的文件所作的所有更改。 将释放所有锁定的记录。 在作业中的落实控制下打开的任何文件都将受到影响。 当打开文件以进行落实控制时,必须指定关键字参数 commit=y。 在此之前必须已设置落实控制环境。
_Rrollbck() 函数对数据库和 DDM 文件有效。
返回值
示例
#include <stdio.h>
#include <recio.h>
#include <stdlib.h>
#include <string.h>
int main(void)
{
char buf[40];
int rc = 1;
_RFILE *purf;
_RFILE *dailyf;
/* Open purchase display file and daily transaction file */
if ( ( purf = _Ropen ( "MYLIB/T1677RD3", "ar+,indicators=y" )) == NULL )
{
printf ( "Display file did not open.\n" );
exit ( 1 );
}
if ( ( dailyf = _Ropen ( "MYLIB/T1677RDA", "wr,commit=y") ) == NULL )
{
printf ( "Daily transaction file did not open.\n" );
exit ( 2 );
}
/* Select purchase record format */
_Rformat ( purf, "PURCHASE" );
/* Invite user to enter a purchase transaction. */
/* The _Rwrite function writes the purchase display. */
_Rwrite ( purf, "", 0 );
_Rreadn ( purf, buf, sizeof(buf), __DFT );
/* Update daily transaction file */
rc = (( _Rwrite ( dailyf, buf, sizeof(buf) ))->num_bytes );
/* If the databases were updated, then commit the transaction. */
/* Otherwise, rollback the transaction and indicate to the */
/* user that an error has occurred and end the application. */
if ( rc )
{
_Rcommit ( "Transaction complete" );
}
else
{
_Rrollbck ( );
_Rformat ( purf, "ERROR" );
}
_Rclose ( purf );
_Rclose ( dailyf );
}相关信息
- _Rcommit ()-落实当前记录
- 恢复系统 手册