Why 整理Paradox数据库??? And How to....???

dycdyc123 2001-07-03 10:08:10
加精
...全文
68 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
Sephil 2001-07-05
  • 打赏
  • 举报
回复
是压缩PARADOX的BDE的API函数

参看下例

void __fastcall TForm1::PackParadoxTable(hDBIDb hDB, AnsiString TblName)
{
//Paradox table use a quite different way to be packed than
//DBase or Foxpro table, it use the DBiDoRestructure not the
// DBiPackTable
DBIResult rslt;
CRTblDesc TblDesc;
//filled the structure CRTbiDesc with 0
memset((void *)&TblDesc,0,sizeof(CRTblDesc));
//copy the table name and type to the structure
lstrcpy(TblDesc.szTblName,TblName.c_str());
lstrcpy(TblDesc.szTblType,szPARADOX);
//set bPack to true to specify Pack Function
TblDesc.bPack=true;
//Pack the table
rslt=DbiDoRestructure(hDB,1,&TblDesc,NULL,NULL,NULL,false);
if(rslt!=DBIERR_NONE)
Application->MessageBox("不能压缩表","压缩数据表出错",MB_ICONERROR);
}
注意,在Restructure之前,表必须处于关闭状态。以下例程调用PackParadoxTable.

void __fastcall TForm1::PackTable(AnsiString table_name)
{
//Pack the table
TTable *temp_table=new TTable(Form1);
temp_table->DatabaseName="YourDatabaseAlias";
temp_table->TableName=table_name;
temp_table->Exclusive=true;
temp_table->Open();
//get the Database Handle
hDBIDb hDB=temp_table->DBHandle;
temp_table->Close();
PackParadoxTable(hDB,table_name);
temp_table->Close();
temp_table->Free();
}

下面给出使用 BDE 的 API 的简短代码:
function PackParadoxTable(aTable: TTable; Db: TDatabase):DBIResult;
var
TblDesc: CRTblDesc;
begin
Result := DBIERR_NA;
FillChar(TblDesc, SizeOf(CRTblDesc), 0);
StrPCopy(TblDesc.szTblName, aTable.TableName);
TblDesc.bPack := True;
Result := DbiDoRestructure(Db.Handle, 1, @TblDesc, nil, nil, nil, False);
end;
wjzhuang 2001-07-03
  • 打赏
  • 举报
回复
DbiDoRestructure?
这是什么函数?那里的?
dycdyc123 2001-07-03
  • 打赏
  • 举报
回复
wjzhuang(醉里挑灯看剑--程序猪):
Yes, I download a Zi_Guang inputing but it doesn't work well!
this prob come from the following:
(怎样用DbiDoRestructure函数来整理Paradox数据库?)
wjzhuang 2001-07-03
  • 打赏
  • 举报
回复
呵呵,你还不能打中文呀?

不太明白你的意思

1,178

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder 数据库及相关技术
社区管理员
  • 数据库及相关技术社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧