dbiisrecordlocked.html
来自「Delphi API应用手册」· HTML 代码 · 共 140 行
HTML
140 行
<HTML>
<HEAD>
<TITLE>BDE API Examples (DbiIsRecordLocked)</TITLE>
<META NAME="KEYWORDS" CONTENT="BDE, Borland">
<META NAME="DESCRIPTION" CONTENT="">
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#000000" ALINK="#999999" VLINK="#666666">
<CENTER>
<TABLE CELLPADDING="4" CELLSPACING="4" BORDER="0" WIDTH="600">
<TR>
<TD ALIGN="CENTER" VALIGN="TOP" COLSPAN="1"><NOBR><A HREF="/"><IMG SRC="/images/bolus.gif" ALT="[View Borland Home Page]" BORDER="0"></A><A HREF="/products.html"><IMG SRC="/images/products.gif" ALT="[View Product List]" BORDER="0"></A><A HREF="/searchsite/"><IMG SRC="/images/search.gif" ALT="[Search This Web Site]" BORDER="0"></A><A HREF="/download.html"><IMG SRC="/images/downloads.gif" ALT="[View Available Downloads]" BORDER="0"></A><A HREF="/membership.html"><IMG SRC="/images/membership.gif" ALT="[Join Borland Online]" BORDER="0"></A><A HREF="/newsgroups/"><IMG SRC="/images/newsgroups.gif" ALT="[Enter Discussion Area]" BORDER="0"></A><A HREF="/feedback/"><IMG SRC="/images/feedback.gif" ALT="[Send Email To Webmaster]" BORDER="0"></A></NOBR></TD>
</TR>
<TR>
<TR><TD ALIGN="LEFT" VALIGN="TOP" COLSPAN="1"><font size=2>
Checks the lock status of the current record.
<hr size=2 noshade>
This example uses the following input:<BR>
<I>IsRecordLocked(Table1, True);</I><BR>
NOTE: If ByAnyone is true, then the function also checks if
any other session has the record locked. If ByAnyone is false, then
only the current session is checked. The function returns False if
not locked, and True if locked.
<PRE>function IsRecordLocked(Table: TTable; ByAnyone: boolean): boolean;
var
Locked: BOOL;
hCur: hDBICur;
rslt: DBIResult;
begin
Table.UpdateCursorPos;
// Is the record locked by the current session...
Check(DbiIsRecordLocked(Table.Handle, Locked));
Result := Locked;
// If the current session does not have a lock and the ByAnyone varable is
// set to check all sessions, continue check...
if (Result = False) and (ByAnyone = True) then
begin
// Get a new cursor to the same record...
Check(DbiCloneCursor(Table.Handle, False, False, hCur));
try
// Try and get the record with a write lock...
rslt := DbiGetRecord(hCur, dbiWRITELOCK, nil, nil);
if rslt <> DBIERR_NONE then
begin
// if an error occured and it is a lock error, return true...
if HiByte(rslt) = ERRCAT_LOCKCONFLICT then
Result := True
else
// If some other error happened, throw an exception...
Check(rslt);
end
else
// Release the lock in this session if the function was successful...
Check(DbiRelRecordLock(hCur, False));
finally
// Close the cloned cursor...
Check(DbiCloseCursor(hCur));
end;
end;
end;</PRE>
<!-- SF, Oct 7th, 1997 -->
<HR SIZE=2 NOSHADE>
<A HREF="/devsupport/bde/bdeapiex/index.html">Back to BDE API Reference Page</A>
</TD></TR>
<TR><TD ALIGN="LEFT" VALIGN="TOP" COLSPAN="1"><font size=2>
<HR SIZE="2" NOSHADE>
<FONT SIZE = 2><i><b>DISCLAIMER:</b> You have the right to use this technical information subject to
the terms of the No-Nonsense License Statement that you received with the Borland product to which
this information pertains.</FONT></i></B>
</dl>
</td>
</TR>
<TR>
<!-- THIS IS THE BOTTOM COPYRIGHT & UPDATED MESSAGE -->
<TD ALIGN="CENTER" VALIGN="TOP" COLSPAN="3"><FONT SIZE="2"><A HREF="/copyright.html">Trademarks & Copyright</A> © 1998 Borland International, Inc.
<SCRIPT LANGUAGE="JavaScript">
<!-- HIDE FROM OLD BROWSERS
// THIS WILL WRITE OUT THE LAST MODIFIED DATE
// YOU DO NOT NEED TO CHANGE ANYTHING HERE
function makeArray(arraySize) {
this.length = arraySize
return this
}
monthNames = new makeArray(12)
monthNames[1] = "January"
monthNames[2] = "February"
monthNames[3] = "March"
monthNames[4] = "April"
monthNames[5] = "May"
monthNames[6] = "June"
monthNames[7] = "July"
monthNames[8] = "August"
monthNames[9] = "September"
monthNames[10] = "October"
monthNames[11] = "November"
monthNames[12] = "December"
updated = new Date(document.lastModified)
theMonth = monthNames[updated.getMonth() + 1]
theDate = updated.getDate()
theYear = updated.getYear() + 1900
document.write("Last modified on " + theDate + "-" + theMonth + "-" + theYear + ".")
// END HIDING -->
</SCRIPT></FONT></TD>
</TR>
</TABLE>
</CENTER>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?