MySQL API functions

Source: Internet
Author: User

MySQL provides a number of functions to operate the database, broadly divided into the following categories:
The first part controls the class function

Mysql_init () initializing MySQL object
Mysql_options () Setting connection options
Mysql_real_connect () connect to MySQL Database
Mysql_real_escape_string () legalizing the query string
mysql_query () emits a query string that ends with a null character
Mysql_real_query () issue a query string
Mysql_store_result () One-time transfer results
Mysql_use_result () pass-by-line results
Mysql_free_result () Releasing the result set
Mysql_change_user () change user
mysql_select_db () Change the default database
Mysql_debug () Send debug information
Mysql_dump_debug_info () Dump debug information
Mysql_ping () test whether the database is active
Mysql_shutdown () Request database shutdown
Mysql_close () to close the database connection


The second part information gets the class function
Mysql_character_set_name () Gets the default character set
Mysql_get_client_info () Get client information
Mysql_host_info () Get host information
Mysql_get_proto_info () Get protocol information
Mysql_get_server_info () Get server information
Mysql_info () Get additional information for a partial query statement
Mysql_stat () Get Database status
Mysql_list_dbs () Get a list of databases
Mysql_list_tables () Get a list of data tables
Mysql_list_fields () Get the field list

The third Part column class operation function
Mysql_field_count () Gets the number of fields
Mysql_affected_rows () Gets the number of rows affected
MYSQL_INSERT_ID () Gets the ID value of the auto_increment column
Mysql_num_fields () Gets the number of fields in the result set
Mysql_field_tell () Gets the current field position
Mysql_field_seek () Position field
Mysql_fetch_field () Gets the current field
Mysql_fetch_field_direct () Gets the specified field
Mysql_frtch_fields () gets an array of all fields

Mysql_num_rows () Gets the number of rows
Mysql_fetch_lengths () Gets the line length
Mysql_row_tell () Gets the current row position
Mysql_row_seek () Row positioning
Mysql_data_seek () Row positioning
Mysql_fetch_row () Get the Forward


Part fourth Threading class operation function
Mysql_list_processes () returns the list of all threads
MYSQL_THREAD_ID () Gets the current thread ID
Mysql_thread_safe () Whether thread mode is supported
Mysql_kill () Kill a thread


Part five error handling class function
Mysql_errno () Get error number
Mysql_error () Get error message

Part six obsolete functions
Mysql_connect ()
mysql_create_db ()
mysql_drop_db ()
Mysql_eof ()
Mysql_reload ()
Mysql_escape_string ()

API interface with MySQL:

  1. Mysql_affected_rows () returns the number of rows affected by the latest update, delete, or insert query.
  2. Mysql_close () closes a server connection.
  3. Mysql_connect () connect a MySQL server. This function is not recommended; use Mysql_real_connect () instead.
  4. Mysql_change_user () Changes the user and database on an open connection.
  5. mysql_create_db () creates a database. The function is not recommended, and the SQL command is used to create DATABASE.
  6. Mysql_data_seek () Searches for an arbitrary row in a query result collection.
  7. Mysql_debug () makes a dbug_push with the given string.
  8. mysql_drop_db () discards a database. The function is not recommended, and the SQL command is used to drop DATABASE.
  9. Mysql_dump_debug_info () lets the server write debug information to the log file.
  10. Mysql_eof () determines whether the last row of a result collection has been read. This function is objected to; Mysql_errno () or mysql_error () can be used instead.
  11. Mysql_errno () returns the error number of the most recently called MySQL function.
  12. Mysql_error () returns an error message for the most recently called MySQL function.
  13. Mysql_escape_string () escapes special characters for strings that are used in SQL statements.
  14. Mysql_fetch_field () returns the type of the next table field.
  15. Mysql_fetch_field_direct () returns the type of a table field, giving a number of fields.
  16. Mysql_fetch_fields () returns an array of all the field structures.
  17. Mysql_fetch_lengths () returns the length of all columns in the current row.
  18. Mysql_fetch_row () Gets the next line from the result collection.
  19. Mysql_field_seek () Places the column cursor on a specified column.
  20. Mysql_field_count () returns the number of results columns for the most recent query.
  21. Mysql_field_tell () returns the position of the field cursor used for the last Mysql_fetch_field ().
  22. Mysql_free_result () frees the memory used by a result collection.
  23. Mysql_get_client_info () returns the customer version information.
  24. Mysql_get_host_info () returns a string that describes the connection.
  25. Mysql_get_proto_info () Returns the protocol version used by the connection.
  26. Mysql_get_server_info () returns the server version number.
  27. Mysql_info () returns information about the most recently executed query.
  28. Mysql_init () Gets or initializes a MySQL structure.
  29. MYSQL_INSERT_ID () returns the ID of the previous query that was generated for a auto_increment column.
  30. Mysql_kill () kills a given thread.
  31. Mysql_list_dbs () returns the name of the database that matches a simple regular expression.
  32. Mysql_list_fields () returns the name of a column that matches a simple regular expression.
  33. Mysql_list_processes () Returns a table for the current server thread.
  34. Mysql_list_tables () returns the name of the table that matches a simple regular expression.
  35. Mysql_num_fields () returns the number of columns that a result collection is heavy.
  36. Mysql_num_rows () returns the number of rows in a result set.
  37. Mysql_options () Sets the connection options for mysql_connect ().
  38. Mysql_ping () Check that the connection to the server is working and reconnect if necessary.
  39. Mysql_query () executes an SQL query that is specified as a null-terminated string.
  40. Mysql_real_connect () connect a MySQL server.
  41. Mysql_real_query () executes an SQL query that is specified as a string with a count.
  42. Mysql_reload () tells the server to reload the authorization table.
  43. Mysql_row_seek () Searches for a row in the result set, using the value returned from Mysql_row_tell ().
  44. Mysql_row_tell () returns the row cursor position.
  45. mysql_select_db () connects a database.
  46. Mysql_shutdown () Shut down the database server.
  47. Mysql_stat () returns the server state as a string.
  48. Mysql_store_result () Retrieves a complete set of results to the customer.
  49. MYSQL_THREAD_ID () returns the ID of the current thread.
  50. Mysql_use_result () Initializes a row of rows to retrieve the result collection.

MySQL API functions

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.