blob: 071d9718eb571d125fc6f582fd8181b41c5c32f2 [file] [log] [blame]
Derek Jones8ede1a22011-10-05 13:34:52 -05001########################
2Generating Query Results
3########################
4
5There are several ways to generate query results:
6
James L Parry15162192014-12-05 23:40:47 -08007.. contents::
8 :local:
9 :depth: 2
10
James L Parry014bc892014-11-24 17:14:19 -080011*************
12Result Arrays
13*************
14
Andrey Andreevab0034b2014-12-11 18:31:51 +020015**result()**
Derek Jones8ede1a22011-10-05 13:34:52 -050016
James L Parrye4a9f642014-11-24 16:20:53 -080017This method returns the query result as an array of **objects**, or
Derek Jones8ede1a22011-10-05 13:34:52 -050018**an empty array** on failure. Typically you'll use this in a foreach
19loop, like this::
20
Joseph Wensleyf24f4042011-10-06 22:53:29 -040021 $query = $this->db->query("YOUR QUERY");
22
23 foreach ($query->result() as $row)
24 {
25 echo $row->title;
26 echo $row->name;
27 echo $row->body;
28 }
Derek Jones8ede1a22011-10-05 13:34:52 -050029
Andrey Andreevab0034b2014-12-11 18:31:51 +020030The above method is an alias of ``result_object()``.
Derek Jones8ede1a22011-10-05 13:34:52 -050031
32If you run queries that might **not** produce a result, you are
33encouraged to test the result first::
34
Joseph Wensleyf24f4042011-10-06 22:53:29 -040035 $query = $this->db->query("YOUR QUERY");
36
37 if ($query->num_rows() > 0)
38 {
39 foreach ($query->result() as $row)
40 {
41 echo $row->title;
42 echo $row->name;
43 echo $row->body;
44 }
45 }
Derek Jones8ede1a22011-10-05 13:34:52 -050046
47You can also pass a string to result() which represents a class to
48instantiate for each result object (note: this class must be loaded)
49
50::
51
52 $query = $this->db->query("SELECT * FROM users;");
53
54 foreach ($query->result('User') as $user)
55 {
Andrey Andreevab0034b2014-12-11 18:31:51 +020056 echo $user->name; // access attributes
57 echo $user->reverse_name(); // or methods defined on the 'User' class
Derek Jones8ede1a22011-10-05 13:34:52 -050058 }
59
Andrey Andreevab0034b2014-12-11 18:31:51 +020060**result_array()**
Derek Jones8ede1a22011-10-05 13:34:52 -050061
James L Parrye4a9f642014-11-24 16:20:53 -080062This method returns the query result as a pure array, or an empty
Derek Jones8ede1a22011-10-05 13:34:52 -050063array when no result is produced. Typically you'll use this in a foreach
64loop, like this::
65
Joseph Wensleyf24f4042011-10-06 22:53:29 -040066 $query = $this->db->query("YOUR QUERY");
67
68 foreach ($query->result_array() as $row)
69 {
70 echo $row['title'];
71 echo $row['name'];
72 echo $row['body'];
73 }
Derek Jones8ede1a22011-10-05 13:34:52 -050074
James L Parry014bc892014-11-24 17:14:19 -080075***********
76Result Rows
77***********
78
Andrey Andreevab0034b2014-12-11 18:31:51 +020079**row()**
Derek Jones8ede1a22011-10-05 13:34:52 -050080
James L Parrye4a9f642014-11-24 16:20:53 -080081This method returns a single result row. If your query has more than
Derek Jones8ede1a22011-10-05 13:34:52 -050082one row, it returns only the first row. The result is returned as an
83**object**. Here's a usage example::
84
Joseph Wensleyf24f4042011-10-06 22:53:29 -040085 $query = $this->db->query("YOUR QUERY");
86
87 if ($query->num_rows() > 0)
88 {
89 $row = $query->row();
90
91 echo $row->title;
92 echo $row->name;
93 echo $row->body;
94 }
Derek Jones8ede1a22011-10-05 13:34:52 -050095
96If you want a specific row returned you can submit the row number as a
97digit in the first parameter::
98
99 $row = $query->row(5);
100
101You can also add a second String parameter, which is the name of a class
102to instantiate the row with::
103
Joseph Wensleyf24f4042011-10-06 22:53:29 -0400104 $query = $this->db->query("SELECT * FROM users LIMIT 1;");
sv3tli0d829a5f2015-03-02 17:22:01 +0200105 $row = $query->row(0, 'User');
Joseph Wensleyf24f4042011-10-06 22:53:29 -0400106
Andrey Andreevab0034b2014-12-11 18:31:51 +0200107 echo $row->name; // access attributes
Joseph Wensleyf24f4042011-10-06 22:53:29 -0400108 echo $row->reverse_name(); // or methods defined on the 'User' class
Derek Jones8ede1a22011-10-05 13:34:52 -0500109
Andrey Andreevab0034b2014-12-11 18:31:51 +0200110**row_array()**
Derek Jones8ede1a22011-10-05 13:34:52 -0500111
Andrey Andreevab0034b2014-12-11 18:31:51 +0200112Identical to the above ``row()`` method, except it returns an array.
Derek Jones8ede1a22011-10-05 13:34:52 -0500113Example::
114
Joseph Wensleyf24f4042011-10-06 22:53:29 -0400115 $query = $this->db->query("YOUR QUERY");
116
117 if ($query->num_rows() > 0)
118 {
119 $row = $query->row_array();
120
121 echo $row['title'];
122 echo $row['name'];
123 echo $row['body'];
124 }
Derek Jones8ede1a22011-10-05 13:34:52 -0500125
126If you want a specific row returned you can submit the row number as a
127digit in the first parameter::
128
129 $row = $query->row_array(5);
130
131In addition, you can walk forward/backwards/first/last through your
132results using these variations:
133
Joseph Wensleyf24f4042011-10-06 22:53:29 -0400134 | **$row = $query->first_row()**
135 | **$row = $query->last_row()**
136 | **$row = $query->next_row()**
137 | **$row = $query->previous_row()**
Derek Jones8ede1a22011-10-05 13:34:52 -0500138
139By default they return an object unless you put the word "array" in the
140parameter:
141
Joseph Wensleyf24f4042011-10-06 22:53:29 -0400142 | **$row = $query->first_row('array')**
143 | **$row = $query->last_row('array')**
144 | **$row = $query->next_row('array')**
145 | **$row = $query->previous_row('array')**
Derek Jones8ede1a22011-10-05 13:34:52 -0500146
Andrey Andreevab0034b2014-12-11 18:31:51 +0200147.. note:: All the methods above will load the whole result into memory
148 (prefetching). Use ``unbuffered_row()`` for processing large
149 result sets.
Juan Ignacio Bordad981e292012-05-18 18:29:24 -0300150
Andrey Andreevab0034b2014-12-11 18:31:51 +0200151**unbuffered_row()**
Juan Ignacio Bordad981e292012-05-18 18:29:24 -0300152
Andrey Andreev69edc432012-12-04 13:32:16 +0200153This method returns a single result row without prefetching the whole
154result in memory as ``row()`` does. If your query has more than one row,
155it returns the current row and moves the internal data pointer ahead.
Juan Ignacio Bordad981e292012-05-18 18:29:24 -0300156
Derek Jonesce79be02012-06-25 23:23:46 -0700157::
Juan Ignacio Bordad981e292012-05-18 18:29:24 -0300158
159 $query = $this->db->query("YOUR QUERY");
160
Juan Ignacio Bordada7c9e02012-05-19 09:42:40 -0300161 while ($row = $query->unbuffered_row())
Juan Ignacio Bordad981e292012-05-18 18:29:24 -0300162 {
163 echo $row->title;
164 echo $row->name;
165 echo $row->body;
166 }
167
Andrey Andreev69edc432012-12-04 13:32:16 +0200168You can optionally pass 'object' (default) or 'array' in order to specify
169the returned value's type::
170
171 $query->unbuffered_row(); // object
172 $query->unbuffered_row('object'); // object
173 $query->unbuffered_row('array'); // associative array
174
James L Parrye4a9f642014-11-24 16:20:53 -0800175*********************
Lonnie Ezellcf3cc1d2015-07-21 10:22:41 -0500176Custom Result Objects
177*********************
178
179You can have the results returned as an instance of a custom class instead of a stdClass or array,
Lonnie Ezelld30f35d2015-07-21 10:48:50 -0500180as the ``result()`` and ``result_array()`` methods allow. This requires that the class is already
Lonnie Ezell25201822015-07-21 21:32:43 -0500181loaded into memory. The object will have all values returned from the database set as properties.
182If these have been declared and are non-public then you should provide a ``__set()``
183method to allow them to be set.
Lonnie Ezellcf3cc1d2015-07-21 10:22:41 -0500184
185Example::
186
187 class User {
Lonnie Ezell25201822015-07-21 21:32:43 -0500188
Lonnie Ezellcf3cc1d2015-07-21 10:22:41 -0500189 protected $id;
190 protected $email;
191 protected $username;
192 protected $last_login;
193
194 public function last_login($format)
195 {
Lonnie Ezellabf089a2015-07-22 09:00:37 -0500196 return $this->last_login->format($format);
Lonnie Ezellcf3cc1d2015-07-21 10:22:41 -0500197 }
198
199 public function __set($name, $value)
200 {
Lonnie Ezellabf089a2015-07-22 09:00:37 -0500201 if ($name === 'last_login')
Lonnie Ezellc87a66b2015-07-22 21:48:02 -0500202 {
203 $this->last_login = DateTime::createFromFormat('U', $value);
204 }
Lonnie Ezellcf3cc1d2015-07-21 10:22:41 -0500205 }
206
207 public function __get($name)
208 {
209 if (isset($this->$name))
210 {
211 return $this->$name;
212 }
213 }
214 }
215
216In addition to the two methods listed below, the following methods also can take a class name
217to return the results as: ``first_row()``, ``last_row()``, ``next_row()``, and ``previous_row()``.
218
219**custom_result_object()**
220
221Returns the entire result set as an array of instances of the class requested. The only parameter
222is the name of the class to instantiate.
223
224Example::
225
226 $query = $this->db->query("YOUR QUERY");
227
Lonnie Ezell25201822015-07-21 21:32:43 -0500228 $rows = $query->custom_result_object('User');
229
230 foreach ($rows as $row)
Lonnie Ezellcf3cc1d2015-07-21 10:22:41 -0500231 {
Lonnie Ezell25201822015-07-21 21:32:43 -0500232 echo $row->id;
233 echo $row->email;
234 echo $row->last_login('Y-m-d');
Lonnie Ezellcf3cc1d2015-07-21 10:22:41 -0500235 }
236
237**custom_row_object()**
238
239Returns a single row from your query results. The first parameter is the row number of the results.
240The second parameter is the class name to instantiate.
241
242Example::
243
244 $query = $this->db->query("YOUR QUERY");
245
Lonnie Ezellc87a66b2015-07-22 21:48:02 -0500246 $row = $query->custom_row_object(0, 'User');
Lonnie Ezellcf3cc1d2015-07-21 10:22:41 -0500247
Lonnie Ezellc87a66b2015-07-22 21:48:02 -0500248 if (is_object($row))
249 {
Lonnie Ezellcf3cc1d2015-07-21 10:22:41 -0500250 echo $row->email; // access attributes
251 echo $row->last_login('Y-m-d'); // access class methods
252 }
253
254You can also use the ``row()`` method in exactly the same way.
255
256Example::
257
Lonnie Ezell25201822015-07-21 21:32:43 -0500258 $row = $query->custom_row_object(0, 'User');
Lonnie Ezellcf3cc1d2015-07-21 10:22:41 -0500259
260*********************
James L Parrye4a9f642014-11-24 16:20:53 -0800261Result Helper Methods
262*********************
Derek Jones8ede1a22011-10-05 13:34:52 -0500263
Andrey Andreevab0034b2014-12-11 18:31:51 +0200264**num_rows()**
Derek Jones8ede1a22011-10-05 13:34:52 -0500265
266The number of rows returned by the query. Note: In this example, $query
267is the variable that the query result object is assigned to::
268
Joseph Wensleyf24f4042011-10-06 22:53:29 -0400269 $query = $this->db->query('SELECT * FROM my_table');
270
271 echo $query->num_rows();
Derek Jones8ede1a22011-10-05 13:34:52 -0500272
Andrey Andreevab0034b2014-12-11 18:31:51 +0200273.. note:: Not all database drivers have a native way of getting the total
Andrey Andreevfdb75412012-03-05 16:32:17 +0200274 number of rows for a result set. When this is the case, all of
Andrey Andreevab0034b2014-12-11 18:31:51 +0200275 the data is prefetched and ``count()`` is manually called on the
276 resulting array in order to achieve the same result.
Andrey Andreevfdb75412012-03-05 16:32:17 +0200277
Andrey Andreevab0034b2014-12-11 18:31:51 +0200278**num_fields()**
Derek Jones8ede1a22011-10-05 13:34:52 -0500279
280The number of FIELDS (columns) returned by the query. Make sure to call
James L Parrye4a9f642014-11-24 16:20:53 -0800281the method using your query result object::
Derek Jones8ede1a22011-10-05 13:34:52 -0500282
Joseph Wensleyf24f4042011-10-06 22:53:29 -0400283 $query = $this->db->query('SELECT * FROM my_table');
284
285 echo $query->num_fields();
Derek Jones8ede1a22011-10-05 13:34:52 -0500286
Andrey Andreevab0034b2014-12-11 18:31:51 +0200287**free_result()**
Derek Jones8ede1a22011-10-05 13:34:52 -0500288
289It frees the memory associated with the result and deletes the result
290resource ID. Normally PHP frees its memory automatically at the end of
291script execution. However, if you are running a lot of queries in a
292particular script you might want to free the result after each query
Andrey Andreevab0034b2014-12-11 18:31:51 +0200293result has been generated in order to cut down on memory consumption.
294
Derek Jones8ede1a22011-10-05 13:34:52 -0500295Example::
296
Joseph Wensleyf24f4042011-10-06 22:53:29 -0400297 $query = $this->db->query('SELECT title FROM my_table');
298
299 foreach ($query->result() as $row)
300 {
301 echo $row->title;
302 }
Andrey Andreevab0034b2014-12-11 18:31:51 +0200303
Joseph Wensleyf24f4042011-10-06 22:53:29 -0400304 $query->free_result(); // The $query result object will no longer be available
305
306 $query2 = $this->db->query('SELECT name FROM some_table');
307
308 $row = $query2->row();
309 echo $row->name;
Andrey Andreevfdb75412012-03-05 16:32:17 +0200310 $query2->free_result(); // The $query2 result object will no longer be available
Andrey Andreev69edc432012-12-04 13:32:16 +0200311
James L Parrye4a9f642014-11-24 16:20:53 -0800312**data_seek()**
Andrey Andreev69edc432012-12-04 13:32:16 +0200313
314This method sets the internal pointer for the next result row to be
315fetched. It is only useful in combination with ``unbuffered_row()``.
316
317It accepts a positive integer value, which defaults to 0 and returns
318TRUE on success or FALSE on failure.
319
320::
321
322 $query = $this->db->query('SELECT `field_name` FROM `table_name`');
323 $query->data_seek(5); // Skip the first 5 rows
324 $row = $query->unbuffered_row();
325
326.. note:: Not all database drivers support this feature and will return FALSE.
James L Parry15162192014-12-05 23:40:47 -0800327 Most notably - you won't be able to use it with PDO.
328
329***************
330Class Reference
331***************
332
Andrey Andreevcd3d9db2015-02-02 13:41:01 +0200333.. php:class:: CI_DB_result
James L Parry15162192014-12-05 23:40:47 -0800334
Andrey Andreevcd3d9db2015-02-02 13:41:01 +0200335 .. php:method:: result([$type = 'object'])
Andrey Andreevab0034b2014-12-11 18:31:51 +0200336
337 :param string $type: Type of requested results - array, object, or class name
338 :returns: Array containing the fetched rows
339 :rtype: array
340
341 A wrapper for the ``result_array()``, ``result_object()``
342 and ``custom_result_object()`` methods.
343
344 Usage: see `Result Arrays`_.
345
Andrey Andreevcd3d9db2015-02-02 13:41:01 +0200346 .. php:method:: result_array()
Andrey Andreevab0034b2014-12-11 18:31:51 +0200347
348 :returns: Array containing the fetched rows
349 :rtype: array
350
351 Returns the query results as an array of rows, where each
352 row is itself an associative array.
353
354 Usage: see `Result Arrays`_.
355
Andrey Andreevcd3d9db2015-02-02 13:41:01 +0200356 .. php:method:: result_object()
Andrey Andreevab0034b2014-12-11 18:31:51 +0200357
358 :returns: Array containing the fetched rows
359 :rtype: array
360
361 Returns the query results as an array of rows, where each
362 row is an object of type ``stdClass``.
363
364 Usage: see `Result Arrays`_.
365
Andrey Andreevcd3d9db2015-02-02 13:41:01 +0200366 .. php:method:: custom_result_object($class_name)
James L Parry15162192014-12-05 23:40:47 -0800367
Andrey Andreevab0034b2014-12-11 18:31:51 +0200368 :param string $class_name: Class name for the resulting rows
369 :returns: Array containing the fetched rows
370 :rtype: array
James L Parry15162192014-12-05 23:40:47 -0800371
Andrey Andreevab0034b2014-12-11 18:31:51 +0200372 Returns the query results as an array of rows, where each
373 row is an instance of the specified class.
374
Andrey Andreevcd3d9db2015-02-02 13:41:01 +0200375 .. php:method:: row([$n = 0[, $type = 'object']])
Andrey Andreevab0034b2014-12-11 18:31:51 +0200376
377 :param int $n: Index of the query results row to be returned
378 :param string $type: Type of the requested result - array, object, or class name
379 :returns: The requested row or NULL if it doesn't exist
380 :rtype: mixed
381
382 A wrapper for the ``row_array()``, ``row_object() and
383 ``custom_row_object()`` methods.
384
385 Usage: see `Result Rows`_.
386
Andrey Andreevcd3d9db2015-02-02 13:41:01 +0200387 .. php:method:: unbuffered_row([$type = 'object'])
Andrey Andreevab0034b2014-12-11 18:31:51 +0200388
389 :param string $type: Type of the requested result - array, object, or class name
390 :returns: Next row from the result set or NULL if it doesn't exist
391 :rtype: mixed
392
393 Fetches the next result row and returns it in the
394 requested form.
395
396 Usage: see `Result Rows`_.
397
Andrey Andreevcd3d9db2015-02-02 13:41:01 +0200398 .. php:method:: row_array([$n = 0])
Andrey Andreevab0034b2014-12-11 18:31:51 +0200399
400 :param int $n: Index of the query results row to be returned
401 :returns: The requested row or NULL if it doesn't exist
402 :rtype: array
403
404 Returns the requested result row as an associative array.
405
406 Usage: see `Result Rows`_.
407
Andrey Andreevcd3d9db2015-02-02 13:41:01 +0200408 .. php:method:: row_object([$n = 0])
Andrey Andreevab0034b2014-12-11 18:31:51 +0200409
410 :param int $n: Index of the query results row to be returned
411 :returns: The requested row or NULL if it doesn't exist
412 :rtype: stdClass
413
414 Returns the requested result row as an object of type
415 ``stdClass``.
416
417 Usage: see `Result Rows`_.
James L Parry15162192014-12-05 23:40:47 -0800418
Andrey Andreevcd3d9db2015-02-02 13:41:01 +0200419 .. php:method:: custom_row_object($n, $type)
James L Parry15162192014-12-05 23:40:47 -0800420
421 :param int $n: Index of the results row to return
Andrey Andreevab0034b2014-12-11 18:31:51 +0200422 :param string $class_name: Class name for the resulting row
423 :returns: The requested row or NULL if it doesn't exist
James L Parry15162192014-12-05 23:40:47 -0800424 :rtype: $type
425
Andrey Andreevab0034b2014-12-11 18:31:51 +0200426 Returns the requested result row as an instance of the
427 requested class.
James L Parry15162192014-12-05 23:40:47 -0800428
Andrey Andreevcd3d9db2015-02-02 13:41:01 +0200429 .. php:method:: data_seek([$n = 0])
James L Parry15162192014-12-05 23:40:47 -0800430
431 :param int $n: Index of the results row to be returned next
Andrey Andreevab0034b2014-12-11 18:31:51 +0200432 :returns: TRUE on success, FALSE on failure
James L Parry15162192014-12-05 23:40:47 -0800433 :rtype: bool
434
435 Moves the internal results row pointer to the desired offset.
James L Parry15162192014-12-05 23:40:47 -0800436
Andrey Andreevab0034b2014-12-11 18:31:51 +0200437 Usage: see `Result Helper Methods`_.
James L Parry15162192014-12-05 23:40:47 -0800438
Andrey Andreevcd3d9db2015-02-02 13:41:01 +0200439 .. php:method:: set_row($key[, $value = NULL])
James L Parry15162192014-12-05 23:40:47 -0800440
Andrey Andreevab0034b2014-12-11 18:31:51 +0200441 :param mixed $key: Column name or array of key/value pairs
442 :param mixed $value: Value to assign to the column, $key is a single field name
443 :rtype: void
444
445 Assigns a value to a particular column.
446
Andrey Andreevcd3d9db2015-02-02 13:41:01 +0200447 .. php:method:: next_row([$type = 'object'])
Andrey Andreevab0034b2014-12-11 18:31:51 +0200448
449 :param string $type: Type of the requested result - array, object, or class name
450 :returns: Next row of result set, or NULL if it doesn't exist
451 :rtype: mixed
452
453 Returns the next row from the result set.
454
Andrey Andreevcd3d9db2015-02-02 13:41:01 +0200455 .. php:method:: previous_row([$type = 'object'])
Andrey Andreevab0034b2014-12-11 18:31:51 +0200456
457 :param string $type: Type of the requested result - array, object, or class name
458 :returns: Previous row of result set, or NULL if it doesn't exist
459 :rtype: mixed
460
461 Returns the previous row from the result set.
James L Parry15162192014-12-05 23:40:47 -0800462
Andrey Andreevcd3d9db2015-02-02 13:41:01 +0200463 .. php:method:: first_row([$type = 'object'])
James L Parry15162192014-12-05 23:40:47 -0800464
Andrey Andreevab0034b2014-12-11 18:31:51 +0200465 :param string $type: Type of the requested result - array, object, or class name
466 :returns: First row of result set, or NULL if it doesn't exist
James L Parry15162192014-12-05 23:40:47 -0800467 :rtype: mixed
468
Andrey Andreevab0034b2014-12-11 18:31:51 +0200469 Returns the first row from the result set.
470
Andrey Andreevcd3d9db2015-02-02 13:41:01 +0200471 .. php:method:: last_row([$type = 'object'])
Andrey Andreevab0034b2014-12-11 18:31:51 +0200472
473 :param string $type: Type of the requested result - array, object, or class name
474 :returns: Last row of result set, or NULL if it doesn't exist
475 :rtype: mixed
476
477 Returns the last row from the result set.
478
Andrey Andreevcd3d9db2015-02-02 13:41:01 +0200479 .. php:method:: num_rows()
Andrey Andreevab0034b2014-12-11 18:31:51 +0200480
481 :returns: Number of rows in the result set
482 :rtype: int
483
484 Returns the number of rows in the result set.
485
486 Usage: see `Result Helper Methods`_.
487
Andrey Andreevcd3d9db2015-02-02 13:41:01 +0200488 .. php:method:: num_fields()
Andrey Andreevab0034b2014-12-11 18:31:51 +0200489
490 :returns: Number of fields in the result set
491 :rtype: int
492
493 Returns the number of fields in the result set.
494
495 Usage: see `Result Helper Methods`_.
496
Andrey Andreevcd3d9db2015-02-02 13:41:01 +0200497 .. php:method:: field_data()
Andrey Andreevab0034b2014-12-11 18:31:51 +0200498
499 :returns: Array containing field meta-data
500 :rtype: array
501
502 Generates an array of ``stdClass`` objects containing
503 field meta-data.
James L Parry15162192014-12-05 23:40:47 -0800504
Andrey Andreevcd3d9db2015-02-02 13:41:01 +0200505 .. php:method:: free_result()
James L Parry15162192014-12-05 23:40:47 -0800506
507 :rtype: void
508
Andrey Andreevab0034b2014-12-11 18:31:51 +0200509 Frees a result set.
James L Parry15162192014-12-05 23:40:47 -0800510
Andrey Andreevab0034b2014-12-11 18:31:51 +0200511 Usage: see `Result Helper Methods`_.
James L Parry15162192014-12-05 23:40:47 -0800512
Andrey Andreevcd3d9db2015-02-02 13:41:01 +0200513 .. php:method:: list_fields()
James L Parry15162192014-12-05 23:40:47 -0800514
515 :returns: Array of column names
516 :rtype: array
517
Andrey Andreevab0034b2014-12-11 18:31:51 +0200518 Returns an array containing the field names in the
sv3tli0d829a5f2015-03-02 17:22:01 +0200519 result set.