Prev | Current Page 649 | Next

W. Jason Gilmore

"Beginning PHP and MySQL: From Novice to Professional"


Furthermore, sqlite_query() is not limited to executing SELECT queries. You can use
this function to execute any supported SQL-92 query.
Executing an Unbuffered SQL Query
The sqlite_unbuffered_query() function can be thought of as an optimized version of
sqlite_query(), identical in every way except that it returns the result set in a format
intended to be used in the order in which it is returned, without any need to search
or navigate it in any other way. Its prototype follows:
resource sqlite_unbuffered_query(resource dbh, string query [, int result_type
[, string &error_msg]])
This function is particularly useful if you??™re solely interested in dumping a result
set to output, an HTML table or a text file, for example.
The optional result_type and &error_msg parameters operate identically to those
introduced in the previous section on sqlite_query().
576 CHAPTER 22 ?–  SQLITE
Because this function is optimized for returning result sets intended to be output
in a straightforward fashion, you cannot pass its output to functions such as sqlite_
num_rows(), sqlite_seek(), or any other function with the purpose of examining or
modifying the output or output pointers. If you require the use of such functions, use
sqlite_query() to retrieve the result set instead.
Retrieving the Most Recently Inserted Row Identifier
It??™s common to reference a newly inserted row immediately after the insertion is
completed, which in many cases is accomplished by referencing the row??™s autoincrement
field.


Pages:
637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661