📄 function.ingres-connect.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html> <head> <title>Open a connection to an Ingres database</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> </head> <body><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.ingres-commit.html">ingres_commit</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.ingres-cursor.html">ingres_cursor</a></div> <div class="up"><a href="ref.ingres.html">Ingres II Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div><hr /><div id="function.ingres-connect" class="refentry"> <div class="refnamediv"> <h1 class="refname">ingres_connect</h1> <p class="verinfo">(PHP 4 >= 4.0.2, PHP 5 <= 5.0.5, PECL ingres:1.0-1.4.3)</p><p class="refpurpose"><span class="refname">ingres_connect</span> — <span class="dc-title">Open a connection to an Ingres database</span></p> </div> <div class="refsect1 description"> <h3 class="title">Description</h3> <div class="methodsynopsis dc-description"> <span class="type">resource</span> <span class="methodname"><b><b>ingres_connect</b></b></span> ([ <span class="methodparam"><span class="type">string</span> <tt class="parameter">$database</tt></span> [, <span class="methodparam"><span class="type">string</span> <tt class="parameter">$username</tt></span> [, <span class="methodparam"><span class="type">string</span> <tt class="parameter">$password</tt></span> [, <span class="methodparam"><span class="type">array</span> <tt class="parameter">$options</tt></span> ]]]] )</div> <p class="para rdfs-comment"> <b>ingres_connect()</b> opens a connection with the given Ingres <i><tt class="parameter">database</tt></i>. </p> <p class="para"> The connection is closed when the script ends or when <a href="function.ingres-close.html" class="function">ingres_close()</a> is called on this link. </p> <p class="para"> All the other ingres functions use the last opened link as a default, so you need to store the returned value only if you use more than one link at a time. </p> </div> <div class="refsect1 parameters"> <h3 class="title">Parameters</h3> <p class="para"> If some parameters are missing, <b>ingres_connect()</b> uses the values in <var class="filename">php.ini</var> for <i><tt class="parameter">ingres.default_database</tt></i>, <i><tt class="parameter">ingres.default_user</tt></i> and <i><tt class="parameter">ingres.default_password</tt></i>. </p> <p class="para"> <dl> <dt> <span class="term"><i><tt class="parameter">database</tt></i></span> <dd> <p class="para"> The database name. Must follows the syntax <var class="varname"><a href="domnotation.props.systemid.html" class="classname">[node_id::]dbname[/svr_class]</a></var>. </p> </dd> </dt> <dt> <span class="term"><i><tt class="parameter">username</tt></i></span> <dd> <p class="para"> The Ingres user name. </p> </dd> </dt> <dt> <span class="term"><i><tt class="parameter">password</tt></i></span> <dd> <p class="para"> The password associated with <i><tt class="parameter">username</tt></i>. </p> </dd> </dt> <dt> <span class="term"><i><tt class="parameter">options</tt></i></span> <dd> <p class="para"> <b>ingres_connect()</b> options <table class="informaltable"> <colgroup> <thead valign="middle"> <tr valign="middle"> <th colspan="1">Option name</th> <th colspan="1">Description</th> </tr> </thead> <tbody valign="middle" class="tbody"> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">date_century_boundary</td> <td colspan="1" rowspan="1" align="left">The threshold by which a 2 digit year is determined to be in the current century or in the next century. Equivalent to II_DATE_CENTURY_BOUNDARY. </td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">group</td> <td colspan="1" rowspan="1" align="left">Speficfies the group ID of the user, equivalent to the '-G' flag</td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">role</td> <td colspan="1" rowspan="1" align="left">The role ID of the application. If a role password is required, the parameter value should be specified as "role/password"</td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">effective_user</td> <td colspan="1" rowspan="1" align="left">The ingres user account being impersonated, equivalent to the '-u' flag</td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">dbms_password</td> <td colspan="1" rowspan="1" align="left">The internal database password for the user connecting to Ingres</td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">table_structure</td> <td colspan="1" rowspan="1" align="left"><p class="para"> The default structure for new tables. Valid values for table_structure are: <ul class="itemizedlist"> <li class="listitem"><span class="simpara">INGRES_STRUCTURE_BTREE</span></li> <li class="listitem"><span class="simpara">INGRES_STRUCTURE_HASH</span></li> <li class="listitem"><span class="simpara">INGRES_STRUCTURE_HEAP</span></li> <li class="listitem"><span class="simpara">INGRES_STRUCTURE_ISAM</span></li> <li class="listitem"><span class="simpara">INGRES_STRUCTURE_CBTREE</span></li> <li class="listitem"><span class="simpara">INGRES_STRUCTURE_CISAM</span></li> <li class="listitem"><span class="simpara">INGRES_STRUCTURE_CHASH</span></li> <li class="listitem"><span class="simpara">INGRES_STRUCTURE_CHEAP</span></li> </ul> </p> </td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">index_structure</td> <td colspan="1" rowspan="1" align="left"><p class="para"> The default structure for new secondary indexes. Valid values for index_structure are: <ul class="itemizedlist"> <li class="listitem"><span class="simpara">INGRES_STRUCTURE_CBTREE</span></li> <li class="listitem"><span class="simpara">INGRES_STRUCTURE_CISAM</span></li> <li class="listitem"><span class="simpara">INGRES_STRUCTURE_CHASH</span></li> <li class="listitem"><span class="simpara">INGRES_STRUCTURE_BTREE</span></li> <li class="listitem"><span class="simpara">INGRES_STRUCTURE_HASH</span></li> <li class="listitem"><span class="simpara">INGRES_STRUCTURE_ISAM</span></li> </ul> </p> </td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">login_local</td> <td colspan="1" rowspan="1" align="left">Determines how the connection user ID and password are used when a VNODE is included in the target database string. If set to TRUE, the user ID and password are used to locally access the VNODE and the VNODE login information is used to establish the DBMS connection. If set to FALSE, the process user ID is used to access the VNODE and the connection user ID and password are used in place of the VNODE login information to establish the DBMS connection. This parameter is ignored if no VNODE is included in the target database string. The default is FALSE.</td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">timezone</td> <td colspan="1" rowspan="1" align="left">Controls the timezone of the session. If not set it will default the the value defined by II_TIMEZONE_NAME. If II_TIMEZONE_NAME is not defined the NA-PACIFIC (GMT-8 with Daylight Savings) is used.</td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">date_format</td> <td colspan="1" rowspan="1" align="left"><p class="para">Sets the allowable input and output format for Ingres dates. Defaults to the value defined by II_DATE_FORMAT. If II_DATE_FORMAT is not set the default date format is US, e.g. mm/dd/yy. Valid values for date_format are: <ul class="itemizedlist"> <li class="listitem"><span class="simpara">INGRES_DATE_DMY</span></li> <li class="listitem"><span class="simpara">INGRES_DATE_FINISH</span></li> <li class="listitem"><span class="simpara">INGRES_DATE_GERMAN</span></li> <li class="listitem"><span class="simpara">INGRES_DATE_ISO</span></li> <li class="listitem"><span class="simpara">INGRES_DATE_ISO4</span></li> <li class="listitem"><span class="simpara">INGRES_DATE_MDY</span></li> <li class="listitem"><span class="simpara">INGRES_DATE_MULTINATIONAL</span></li> <li class="listitem"><span class="simpara">INGRES_DATE_MULTINATIONAL4</span></li> <li class="listitem"><span class="simpara">INGRES_DATE_YMD</span></li> <li class="listitem"><span class="simpara">INGRES_DATE_US</span></li> </ul> </p> </td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">decimal_separator</td> <td colspan="1" rowspan="1" align="left">The character identifier for decimal data</td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">money_lort</td> <td colspan="1" rowspan="1" align="left"><p class="para">Leading or trailing currency sign. Valid values for money_lort are: <ul class="itemizedlist"> <li class="listitem"><span class="simpara">INGRES_MONEY_LEADING</span></li> <li class="listitem"><span class="simpara">INGRES_MONEY_TRAILING</span></li> </ul> </p> </td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">money_sign</td> <td colspan="1" rowspan="1" align="left">The currency symbol to be used with the MONEY datatype</td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">money_precision</td> <td colspan="1" rowspan="1" align="left">The precision of the MONEY datatype</td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">float4_precision</td> <td colspan="1" rowspan="1" align="left">Precision of the FLOAT4 datatype</td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">float8_precision</td> <td colspan="1" rowspan="1" align="left">Precision of the FLOAT8 data</td> </tr> <tr valign="middle"> <td colspan="1" rowspan="1" align="left">blob_segment_length</td> <td colspan="1" rowspan="1" align="left">The amount of data in bytes to fetch at a time when retrieving BLOB/CLOB data, defaults to 4096 bytes when not explicitly set.</td> </tr> </tbody> </colgroup> </table> </p> </dd> </dt> </dl> </p> </div> <div class="refsect1 returnvalues"> <h3 class="title">Return Values</h3> <p class="para"> Returns a Ingres link resource on success, or <b><tt>FALSE</tt></b> on failure. </p> </div> <div class="refsect1 examples"> <h3 class="title">Examples</h3> <p class="para"> <div class="example"> <p><b>Example #1 <b>ingres_connect()</b> example</b></p> <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php<br />$link </span><span style="color: #007700">= </span><span style="color: #0000BB">ingres_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">"mydb"</span><span style="color: #007700">, </span><span style="color: #DD0000">"user"</span><span style="color: #007700">, </span><span style="color: #DD0000">"pass"</span><span style="color: #007700">)<br /> or die(</span><span style="color: #DD0000">"Could not connect"</span><span style="color: #007700">);<br />echo </span><span style="color: #DD0000">"Connected successfully"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">ingres_close</span><span style="color: #007700">(</span><span style="color: #0000BB">$link</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?></span></span></code></div> </div> </div> <div class="example"> <p><b>Example #2 <b>ingres_connect()</b> example using default link </b></p> <div class="example-contents"><div class="phpcode"><code><span style="color: #000000"><span style="color: #0000BB"><?php<br />ingres_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">"mydb"</span><span style="color: #007700">, </span><span style="color: #DD0000">"user"</span><span style="color: #007700">, </span><span style="color: #DD0000">"pass"</span><span style="color: #007700">)<br /> or die(</span><span style="color: #DD0000">"Could not connect"</span><span style="color: #007700">);<br />echo </span><span style="color: #DD0000">"Connected successfully"</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">ingres_close</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">?></span></span></code></div> </div> </div> </p> </div> <div class="refsect1 seealso"> <h3 class="title">See Also</h3> <p class="para"> <ul class="simplelist"> <li class="member"><a href="function.ingres-pconnect.html" class="function" rel="rdfs-seeAlso">ingres_pconnect()</a></li> <li class="member"><a href="function.ingres-close.html" class="function" rel="rdfs-seeAlso">ingres_close()</a></li> </ul> </p> </div></div><hr /><div style="text-align: center;"> <div class="prev" style="text-align: left; float: left;"><a href="function.ingres-commit.html">ingres_commit</a></div> <div class="next" style="text-align: right; float: right;"><a href="function.ingres-cursor.html">ingres_cursor</a></div> <div class="up"><a href="ref.ingres.html">Ingres II Functions</a></div> <div class="home"><a href="index.html">PHP Manual</a></div></div></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -