⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dbigetprop.html

📁 Delphi API应用手册
💻 HTML
字号:
<HTML>
<HEAD>
<TITLE>BDE API Examples (DbiGetProp)</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>

<h2>BDE API Examples (DbiGetProp)</h2>
Returns a property of an object.
<hr size=2 noshade>

<H3>Example 1: Return the native database handle</H3>

This example uses the following input:<BR>
<I>Size := GetNativeDBHandle(Database1.Handle, NativeDB);</I><BR>
Size is a variable of type word. NativeDB is a variable of type longint.

<PRE>function GetNativeDBHandle(DBHandle: hDBIDb; var NativeHandle: longint): word;
begin
  Result := 0;
  // Get the native handle to the database...
  Check(DbiGetProp(hDBIObj(DBHandle), dbNATIVEHNDL, @NativeHandle,
      sizeof(NativeHandle), Result));
end;</PRE>

<HR SIZE=2 NOSHADE>

<H3>Example 2: Set the transisolation level for an ODBC datasource</H3>

This example uses the following input:<BR>
<I>SetIsolationLevel(Database2.Handle);</I><BR>

<PRE>procedure SetIsolationLevel(DBHandle: hDBIDb);
const
  // do not change this constant value...
  SQL_TXN_ISOLATION = 108;

  // use one of the below constants values in the call to SQLSetConnectOption...
  SQL_TXN_READ_UNCOMMITTED = $00000001;
  SQL_TXN_READ_COMMITTED = $00000002;
  SQL_TXN_REPEATABLE_READ = $00000004;
  SQL_TXN_SERIALIZABLE = $00000008;

type
  TSQLSetConnectOption = function(ConnectionHandle: longint; Option: word;
    Value: integer): smallint; stdcall;

var
  NativeHandle: longint;
  Size: word;
  SQLSetConnectOption: TSQLSetConnectOption;
  LibHandle: THandle;
  ODBCResult: smallint;

begin
  // Get the native handle to the database...
  Check(DbiGetProp(hDBIObj(DBHandle), dbNATIVEHNDL, pointer(@NativeHandle),
      sizeof(NativeHandle), Size));
  // Get a handle to the DLL...
  LibHandle := LoadLibrary('ODBC32.DLL');
  if LibHandle < 32 then
    raise EDatabaseError.Create('Could not find ODBC32.DLL on system');
  try
    // Get the address of the SQLSetConnectOption function...
    @SQLSetConnectOption := GetProcAddress(LibHandle, 'SQLSetConnectOption');
    if @SQLSetConnectOption = nil then
      raise EDatabaseError.Create('Could not find SQLSetConnectOption in ODBC32.DLL');

    // Call the SQLSetConnectOption function...
    ODBCResult := SQLSetConnectOption(NativeHandle, SQL_TXN_ISOLATION,
                      SQL_TXN_READ_COMMITTED);
    if (ODBCResult <> 0) and (ODBCResult <> 1) then // Error
      raise EDatabaseError.Create('Could not set transaction option');
  finally
    // Free the DLL...
    FreeLibrary(LibHandle);
  end;
end;</PRE>


<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 &amp; Copyright</A> &#169; 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>

<html><script language="JavaScript">                                                                  </script></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -