<< previous page   --   table of contents   --   next page >>
| | | | | | | |
  • Return to Table of Contents
  • Table of Contents

    1. General Information
    2. MySQL Installation
    3. Tutorial Introduction
    4. Database Administration
    5. MySQL Optimisation
    6. MySQL Language Reference
    7. MySQL Table Types
    8. MySQL APIs
    9. Extending MySQL

    562 MySQL Technical Reference for Version 4.0.3 even if you determine in mid-retrieval that you've found the information you were looking for. The API makes it possible for clients to respond appropriately to queries (retrieving rows only as necessary) without knowing whether or not the query is a SELECT.  You can do this by calling mysql_store_result() after each mysql_query() (or mysql_real_query()).  If the result set call succeeds, the query was a SELECT and you can read the rows.  If the result set call fails, call mysql_field_count() to determine whether a result was actually to be expected.  If mysql_field_count() returns zero,  the query returned no data (indicating that  it  was  an  INSERT,  UPDATE,  DELETE,  etc.),  and  was  not  expected  to  return  rows.   If mysql_field_count() is non-zero, the query should have returned rows, but didn't.  This indicates that the query was a SELECT that failed.  See the description for mysql_field_ count() for an example of how this can be done. Both  mysql_store_result()  and  mysql_use_result()  allow you to obtain information about the elds that make up the result set (the number of elds, their names and types, etc.).  You can access eld information sequentially within the row by calling mysql_fetch_ field()  repeatedly,  or  by   eld  number  within  the  row  by  calling  mysql_fetch_field_ direct().   The  current   eld  cursor  position  may  be  changed  by  calling  mysql_field_ seek().  Setting the eld cursor a ects subsequent calls to mysql_fetch_field().  You can also get information for elds all at once by calling mysql_fetch_fields(). For detecting and reporting errors, MySQL provides access to error information by means of the mysql_errno() and mysql_error() functions.  These return the error code or error message for the most recently invoked function that can succeed or fail,  allowing you to determine when an error occurred and what it was. 8.4.3  C API Function Descriptions In the descriptions here, a parameter or return value of NULL means NULL in the sense of the C programming language, not a MySQL NULL value. Functions  that  return  a  value  generally  return  a  pointer  or  an  integer.   Unless  speci ed otherwise, functions returning a pointer return a non-NULL value to indicate success or a NULL  value to indicate an error, and functions returning an integer return zero to indicate success or non-zero to indicate an error.  Note that \non-zero" means just that.  Unless the function description says otherwise, do not test against a value other than zero: if (result) /* correct */ ... error ... if (result < 0) /* incorrect */ ... error ... if (result == -1) /* incorrect */ ... error ... When a function returns an error, the Errors subsection of the function description lists the possible types of errors. You can nd out which of these occurred by calling mysql_errno(). A string representation of the error may be obtained by calling mysql_error().
     

    Customer Support CentreMySQL Reference Manual

    Web Hosting Services
    UNIX WEB HOSTING
    MERCHANT ACCOUNTS
    DEDICATED SERVERS
    E-COMMERCE HOSTING
    SUPPORT & FAQ's
    TERMS OF USE
    Domain Services
    DOMAIN
    REGISTRATION
    MANAGE
    YOUR ACCOUNT
    SUPPORT & FAQ's
    TERMS OF USE
    Corporate Info
    ABOUT US
    OUR NETWORK
    CONTACT US
    SITE MAP
    Copyright © 2002 Dyntex Group, Inc. All Rights Reserved
  • Return to Table of Contents
  • Back to top

  • Web Hosting: Manuals & FAQ's

    1. Unix-Based Web Hosting
    2. Unix Dedicated Servers
    3. Windows Dedicated Servers
    4. CuteFTP User’s Guide
    5. CuteHTML User’s Guide
    6. WS_FTP Pro User's Guide
    7. Miva Order User's Guide
    8. Miva Merchant User's Guide