由于表经常地进行增加删除,所以表文件会一直增大所以想请教用什么方法可以对表进行压缩
谢谢
谢谢
解决方案 »
- 想设置一些不规则的Button,如园形、平行四边形等。用什么控件?
- 求助:怎样才能不出现系统默认的提示框?
- 在线等,急!!!关于 DBChart 的问题?
- 我已经在TWebBrowser的PopupMenu里加入了我自己的PopupMenu事件,当然里面什么也没写,但是点击鼠标右键还是有快捷菜单出来为什么啊?
- table和adoquery的连接问题?
- delphi波特率设置
- 52个名牌保险套(年底了,大家轻松一下,笑一笑)
- 又散分
- 怎样对XML数据记录直接进行读取、修改、添加等等数据集操作。[急]
- 知道对方网站的ip,用delphi怎样返回对方的端口。
- 如何打印DBGird中的内容
- stringgridex是for D6的还是for D5的?dsgnintf.dcu怎么解决的啊?你们是怎么装的?
Specifies the valid database handle.
hCursor Type: hDBICur (Input)
Specifies the cursor on the table to be packed. Optional. If hCursor is specified, the operation is performed on the table associated with the cursor. If hCursor is NULL, pszTableName and pszDriverType determine the table to be used.
pszTableName Type: pCHAR (Input)
Pointer to the table name. Optional. If hCursor is NULL, pszTblName and pszTblType determine the table to be used. (If both pszTableName and hCursor are specified, pszTableName is ignored.) If pszTableName is a fully qualified name of a table, the pszDriverType parameter need not be specified. If the path is not included, the path name is taken from the current directory of the database associated with hDb. pszDriverType Type: pCHAR (Input)
Pointer to the driver type. Optional. This parameter is required if pszTableName has no extension. The only valid pszDriverType is szDBASE.
bRegenIdxs Type: BOOL (Input)
Specifies whether or not to regenerate out-of-date table indexes. If TRUE, all out-of-date table indexes are regenerated (applies to maintained indexes only). Otherwise, out-of-date indexes are not regenerated.UsagedBASE or FoxPro: dBASE and FoxPro let users a record for deletion (as opposed to actually removing it from the table). The only way to permanently remove ed records is with DbiPackTable. Paradox: This function is not valid for Paradox tables. Use DbiDoRestructure with the bPack option, instead.SQL, Access: This function is not valid for SQL or Access tables.PrerequisitesExclusive access to the table is required. DbiResult return valuesDBIERR_NONE The table was successfully rebuilt.
DBIERR_INVALIDPARAM The specified table name or the pointer to the table name is NULL.
DBIERR_INVALIDHNDL The specified database handle or cursor handle is invalid or NULL.
DBIERR_NOSUCHTABLE Table name does not exist.
DBIERR_UNKNOWNTBLTYPE Table type is unknown.
DBIERR_NEEDEXCLACCESS The table is not open in exclusive mode.
// The table must be opened execlusively before calling this function...
procedure PackTable(Table: TTable);
var
Props: CURProps;
hDb: hDBIDb;
TableDesc: CRTblDesc;
begin
// Make sure the table is open exclusively so we can get the db handle...
if not Table.Active then
raise EDatabaseError.Create('Table must be opened to pack');
if not Table.Exclusive then raise EDatabaseError.Create('Table must be opened exclusively to pack'); // Get the table properties to determine table type...
Check(DbiGetCursorProps(Table.Handle, Props)); // If the table is a Paradox table, you must call DbiDoRestructure...
if Props.szTableType = szPARADOX then begin
// Blank out the structure...
FillChar(TableDesc, sizeof(TableDesc), 0);
// Get the database handle from the table's cursor handle... Check(DbiGetObjFromObj(hDBIObj(Table.Handle), objDATABASE, hDBIObj(hDb)));
// Put the table name in the table descriptor...
StrPCopy(TableDesc.szTblName, Table.TableName);
// Put the table type in the table descriptor...
StrPCopy(TableDesc.szTblType, Props.szTableType);
// Set the Pack option in the table descriptor to TRUE...
TableDesc.bPack := True;
// Close the table so the restructure can complete...
Table.Close;
// Call DbiDoRestructure... Check(DbiDoRestructure(hDb, 1, @TableDesc, nil, nil, nil, False));
end
else
// If the table is a dBASE table, simply call DbiPackTable...
if (Props.szTableType = szDBASE) then
Check(DbiPackTable(Table.DBHandle, Table.Handle, nil, szDBASE, True))
else
// Pack only works on PAradox or dBASE; nothing else...
raise EDatabaseError.Create('Table must be either of Paradox or dBASE ' + 'type to pack'); Table.Open;end;