File: sqlite-query.xml

package info (click to toggle)
phpdoc 20050512-1
  • links: PTS
  • area: non-free
  • in suites: sarge
  • size: 36,592 kB
  • ctags: 1,501
  • sloc: xml: 376,768; php: 6,708; cpp: 500; makefile: 293; perl: 161; sh: 151; awk: 28
file content (135 lines) | stat: -rw-r--r-- 4,457 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.13 $ -->
<refentry id="function.sqlite-query">
 <refnamediv>
  <refname>sqlite_query</refname>
  <refname>SQLiteDatabase->query</refname>
  <refpurpose>Executes a query against a given database and returns a result handle</refpurpose>
 </refnamediv>

 <refsect1 role="description">
  &reftitle.description;
  <methodsynopsis>
   <type>resource</type><methodname>sqlite_query</methodname>
   <methodparam><type>resource</type><parameter>dbhandle</parameter></methodparam>
   <methodparam><type>string</type><parameter>query</parameter></methodparam>
  </methodsynopsis>
  <methodsynopsis>
   <type>resource</type><methodname>sqlite_query</methodname>
   <methodparam><type>string</type><parameter>query</parameter></methodparam>
   <methodparam><type>resource</type><parameter>dbhandle</parameter></methodparam>
  </methodsynopsis>
  <para>Object oriented style (method):</para>
  <classsynopsis>
   <ooclass><classname>SQLiteDatabase</classname></ooclass>
   <methodsynopsis>
    <type>SQLiteResult</type><methodname>query</methodname>
    <methodparam><type>string</type><parameter>query</parameter></methodparam>
   </methodsynopsis>
  </classsynopsis>
  <para>
   Executes an SQL statement given by the <parameter>query</parameter> against
   a given database handle.
  </para>
 </refsect1>

 <refsect1 role="parameters">
  &reftitle.parameters;
  <para>
   <variablelist>
    <varlistentry>
     <term><parameter>query</parameter></term>
     <listitem>
      <para>
       The query to be executed.
      </para>
     </listitem>
    </varlistentry>
    <varlistentry>
     <term><parameter>dbhandle</parameter></term>
     <listitem>
      <para>
       The SQLite Database resource; returned from <function>sqlite_open
       </function> when used procedurally.  This parameter is not required
       when using the object-oriented method.
      </para>
     </listitem>
    </varlistentry>
   </variablelist>
  </para>
  &sqlite.param-compat;
 </refsect1>

 <refsect1 role="returnvalues">
  &reftitle.returnvalues;
  <para>
   This function will return a result handle or &false; on failure.
   For queries that return rows, the result handle can then be used with
   functions such as <function>sqlite_fetch_array</function> and
   <function>sqlite_seek</function>.
  </para>
  <para>
   Regardless of the query type, this function will return &false; if the
   query failed.
  </para>
  <para>
   <function>sqlite_query</function> returns a buffered, seekable result
   handle.  This is useful for reasonably small queries where you need to
   be able to randomly access the rows.  Buffered result handles will
   allocate memory to hold the entire result and will not return until it
   has been fetched.  If you only need sequential access to the data, it is
   recommended that you use the much higher performance
   <function>sqlite_unbuffered_query</function> instead.
  </para>
 </refsect1>

 <refsect1 role="notes">
  &reftitle.notes;
  <warning>
   <simpara>
    SQLite <emphasis>will</emphasis> execute multiple queries separated by
    semicolons, so you can use it to execute a batch of SQL that you have
    loaded from a file or have embedded in a script. However, this works only
    when the result of the function is not used - if it is used, 
    only the first SQL statement would be executed. Function
    <function>sqlite_exec</function> will always execute multiple SQL 
    statements.
   </simpara>
   <simpara>
    When executing multiple queries, the return value of this function
    will be &false; if there was an error, but undefined otherwise (it might
    be &true; for success or it might return a result handle).
   </simpara>
  </warning>
 </refsect1>

 <refsect1 role="seealso">
  &reftitle.seealso;
  <para>
   <simplelist>
    <member><function>sqlite_unbuffered_query</function></member>
    <member><function>sqlite_array_query</function></member>
   </simplelist>
  </para>
 </refsect1>
</refentry>

<!-- Keep this comment at the end of the file
 Local variables:
 mode: sgml
 sgml-omittag:t
 sgml-shorttag:t
 sgml-minimize-attributes:nil
 sgml-always-quote-attributes:t
 sgml-indent-step:1
 sgml-indent-data:t
 sgml-parent-document:nil
 sgml-default-dtd-file:"../../manual.ced"
 sgml-exposed-tags:nil
 sgml-local-catalogs:nil
 sgml-local-ecat-files:nil
 End:
 vim600: syn=xml fen fdm=syntax fdl=2 si
 vim: et tw=78 syn=sgml
 vi: ts=1 sw=1
 -->