📄 cconnection.html
字号:
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<TITLE></TITLE>
</HEAD>
<BODY>
<H1>Class CConnection
<HR>
</H1>
<P> A
CConnection represents a session with a specific database. Within the context
of a CConnection, SQL statements are executed and results are returned.
<P><B>Note:</B> By default the CConnection automatically commits changes after
executing each statement. If auto commit has been disabled, an explicit commit
must be done or database changes will not be saved.
<P>
<DL>
<DT><B>See Also:</B>
<DD>
<A href="CStatement.html" target="">CStatement</A>, <A
href="CResultSet.html">CResultSet</A></DD></DL>
<P>
<HR>
<P></P>
<TABLE border=1 cellPadding=1 cellSpacing=1 style="HEIGHT: 67px; WIDTH: 578px"
width="75%">
<TR>
<TD><FONT size=+2><B>Constructor Summary</B></FONT> </TD></TR>
<TR>
<TD><STRONG><A
href="#CConnection">CConnection</A></STRONG>()<BR><DD>Constructs a CConnection object. You must
initialize the object by calling
<STRONG>connect</STRONG>.</DD></TD></TR></TABLE>
<P> </P>
<TABLE border=1 cellPadding=1 cellSpacing=1 style="HEIGHT: 63px; WIDTH: 578px"
width="75%">
<TR>
<TD colSpan=2><FONT size=+2><B>Method Summary</B></FONT> </TD></TR>
<TR>
<TD>
<P align=right>int</P></TD>
<TD><STRONG><A
href="#commit">commit</A></STRONG>()<BR><DD>Commits the transaction associated with a
specified service context.</DD>
</TD></TR>
<TR>
<TD>
<P align=right>int</P></TD>
<TD><STRONG><A
href="#connect">connect</A></STRONG>(const char *username, const char *password,
const char *dblink)<BR><DD>This function is used to create a simple logon
session.</DD>
</TD></TR>
<TR>
<TD>
<P align=right><A
href="CStatement.html">CStatement</A>* </P></TD>
<TD><STRONG><A
href="#createStatement">createStatement</A></STRONG>()<BR><DD>SQL statements with or without
parameters are normally executed using <STRONG>CStatement</STRONG>
objects.</DD>
</TD></TR>
<TR>
<TD>
<P align=right>private int</P></TD>
<TD><STRONG><A
href="#deallocate">deallocate</A></STRONG>()<BR><DD>Freeing an allocated OCI environment.</DD>
</TD></TR>
<TR>
<TD>
<P align=right>int</P></TD>
<TD><STRONG><A
href="#disconnect">disconnect</A></STRONG>()<BR><DD>This function is used to terminate a
connection and session created with <STRONG>connect</STRONG>().</DD></TD></TR>
<TR>
<TD>
<P align=right> <A
href="CResultSet.html">CResultSet</A>*</P></TD>
<TD><STRONG><A
href="#getColumnComments">getColumnComments</A></STRONG>(const char* tab_name = NULL)<BR><DD>Get the column comments.</DD>
</TD></TR>
<TR>
<TD>
<P align=right> <A
href="CResultSet.html">CResultSet</A>*</P></TD>
<TD><STRONG><A
href="#getTableComments">getTableComments</A></STRONG>()<BR><DD>Get the table comments.</DD> </TD></TR>
<TR>
<TD>
<P align=right>private int</P></TD>
<TD><STRONG><A
href="#init">init</A></STRONG>()<BR><DD>Creating and initializing an OCI
environment.</DD>
</TD></TR>
<TR>
<TD>
<P align=right>int </P></TD>
<TD><STRONG><A
href="#rollback">rollback</A></STRONG>()<BR><DD>Rolls back the current
transaction.</DD>
</TD></TR></TABLE>
<P> </P>
<P>
<TABLE border=1 cellPadding=1 cellSpacing=1 style="HEIGHT: 23px; WIDTH: 577px"
width="75%">
<TR>
<TD><FONT size=+2><B><FONT size=+2><B>Constructor
Detail</B></FONT></B></FONT></TD></TR></TABLE></P>
<A name="CConnection"></A>
<P><STRONG>CConnection::CConnection<BR></STRONG></P>
<P><STRONG>CConnection</STRONG>();</P><DL><DD>Constructs a <STRONG>CConnection</STRONG> object. After constructing the object, you must call its <STRONG>connect</STRONG> member function to establish a connection to a specified data source.</DD></DL>
<P> </P>
<P>
<TABLE border=1 cellPadding=1 cellSpacing=1 style="HEIGHT: 23px; WIDTH: 577px"
width="75%">
<TR>
<TD><FONT size=+2><B>Method Detail</B></FONT></TD></TR></TABLE></P>
<A name="commit"></A>
<P><STRONG>CConnection::commit<BR></STRONG></P>
<P>int <STRONG>commit</STRONG>();</P>
<DL>
<DD>Commits the transaction associated with a specified
service context.
<DD><STRONG>Returns:</STRONG>
<DL><DD>either the error code or 0 for SQL success.</DD></DL></DD>
</DL>
<HR>
<P>
<A name="connect"></A>
<P><STRONG>CConnection::connect<BR></STRONG></P>
<P>int <STRONG>connect</STRONG>(const char *username, const char *password,
const char *dblink);</P>
<DL>
<DD>This function is used to create a simple logon session.
<DD><STRONG>Parameters:</STRONG>
<DL>
<DD>username - the username.
<DD>password - the user's password.
<DD>dblink - the name of the database to connect to.</DD>
</DL>
<DD><STRONG>Returns:</STRONG>
<DL>
<DD>either the error code or 0 for SQL success.</DD></DL></DD></DL>
<HR>
<A name="createStatement"></A>
<P><STRONG>CConnection::createStatement<BR></STRONG></P>
<P>
<A href="CStatement.html" target="">CStatement</A>*
<STRONG>createStatement</STRONG>
();</P>
<DL>
<DD>SQL statements with or without parameters are
normally executed using CStatement objects.
<DD><STRONG>Returns:</STRONG>
<DL>
<DD> pointer to a new CStatement object.</DD></DL></DD></DL>
<HR>
<A name="deallocate"></A>
<P><STRONG>CConnection::deallocate<BR></STRONG></P>
<P>
private int <STRONG>deallocate</STRONG>();</P>
<DL>
<DD>Freeing an allocated OCI environment.
<DD><STRONG>Returns:</STRONG>
<DL>
<DD>either the error code or 0 for SQL success.</DD></DL></DD></DL>
<HR>
<A name="disconnect"></A>
<P><STRONG>CConnection::disconnect<BR></STRONG></P>
<P>
int <STRONG>disconnect</STRONG>();</P>
<DL>
<DD>This function is used to terminate a connection and
session created with connect().
<DD><STRONG>Returns:</STRONG>
<DL>
<DD>either the error code or 0 for SQL success.</DD></DL></DD></DL>
<HR>
<A name="getColumnComments"></A>
<P><STRONG>CConnection::getColumnComments<BR></STRONG></P>
<P> <A
href="CResultSet.html">CResultSet</A>*
<STRONG>getColumnComments</STRONG>
(const char* tab_name);</P>
<DL>
<DD> Gets the column comments.
<DD><STRONG>Parameters:</STRONG>
<DL>
<DD>tab_name - the table name.</DD>
</DL>
<DD><STRONG>Returns:</STRONG>
<DL>
<DD> pointer to a new CResultSet object.</DD></DL></DD></DL>
<HR>
<A name="getTableComments"></A>
<P><STRONG>CConnection::<STRONG>getTableComments</STRONG><BR></STRONG></P>
<P> <A
href="CResultSet.html">CResultSet</A>*
<STRONG>getTableComments</STRONG>
();</P>
<DL>
<DD>Gets the table comments.
<DD><STRONG>Returns:</STRONG>
<DL>
<DD> pointer to a new CResultSet object.</DD></DL></DD></DL>
<P>
<HR>
<A name="init"></A>
<P><STRONG>CConnection::init<BR></STRONG></P>
<P>
int <STRONG>init</STRONG>();</P>
<DL>
<DD>Creating and initializing an OCI environment.
<DD><STRONG>Returns:</STRONG>
<DL>
<DD>either the error code or 0 for SQL success.</DD></DL></DD></DL>
<HR>
<A name="rollback"></A>
<P><STRONG>CConnection::rollback<BR></STRONG></P>
<P>
int <STRONG>rollback</STRONG>();</P>
<DL>
<DD>Rolls back the current transaction.
<DD><STRONG>Returns:</STRONG>
<DL>
<DD>either the error code or 0 for SQL success.</DD></DL></DD></DL>
<HR>
<A href="mailto:yakovlev@zdnetonebox.com">Submit comments/suggestions about
OCL.</A> <BR>Copyright 2001 Sergey Yakovlev. All
Rights Reserved.
<P></P>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -