1
<?xml version='1.0' encoding='UTF-8'?>
2
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3
"docbook/dtd/xml/4.2/docbookx.dtd" [
4
<!ENTITY % global_ents SYSTEM "../global.ent">
7
<refentry id="functions.mysql_init" display-name="0"> <refmeta>
8
<refentrytitle>mysql_init</refentrytitle>
11
<refname>mysql_init</refname>
12
<refpurpose>Initialize a connection</refpurpose>
14
<refsect1 role="description">
17
<methodname>mysql_init</methodname>
18
<methodparam><type>MYSQL *</type><parameter>mysql</parameter></methodparam>
21
<para>Prepares and initializes a MYSQL structure to be used with <function>mysql_real_connect()</function>.</para>
22
<para>If <function>mysql_thread_init()</function> was not called before, <function>mysql_init()</function> will also initialize the thread subsystem for the current thread.</para>
24
<refsect1 role="parameters">
25
<title>Parameters</title>
27
<varlistentry><term><parameter>mysql</parameter></term><listitem><para>A pointer to MYSQL or NULL. In case of passing a NULL pointer <function>mysql_init()</function> will allocate memory and return a pointer to a MYSQL structure.</para></listitem></varlistentry>
30
<refsect1 role="returnvalue">
31
<title>Return value</title>
32
<para>A pointer to a MYSQL structure or NULL if an error occured.</para>
34
<refsect1 role="notes">
37
<para>Any subsequent calls to any mysql function (except <function>mysql_options()</function>) will fail until <function>mysql_real_connect()</function> was called.</para>
38
<para>Memory allocated by <function>mysql_init()</function> must be freed with <function>mysql_close()</function>.</para>
41
<refsect1 role="seealso">
42
<title>See also</title>
44
<function>mysql_real_connect()</function>, <function>mysql_options()</function>, <function>mysql_thread_init()</function>, <function>mysql_close()</function>,