wpdb{}WP 0.71

WordPress database access abstraction class.

This class is used to interact with a database without needing to use raw SQL statements. By default, WordPress uses this class to instantiate the global $wpdb object, providing access to the WordPress database.

It is possible to replace this class with your own by setting the $wpdb global variable in wp-content/db.php file to your class. The wpdb class will still be included, so you can extend it or simply use your own.

Usage

$wpdb = new wpdb();
// use class methods

Methods

  1. public __construct( $dbuser, $dbpassword, $dbname, $dbhost )
  2. public __get( $name )
  3. public __isset( $name )
  4. public __set( $name, $value )
  5. public __unset( $name )
  6. private _do_query( $query )
  7. public _escape( $data )
  8. public _insert_replace_helper( $table, $data, $format = null, $type = 'INSERT' )
  9. public _real_escape( $string )
  10. public _weak_escape( $string )
  11. public add_placeholder_escape( $query )
  12. public bail( $message, $error_code = '500' )
  13. protected check_ascii( $string )
  14. public check_connection( $allow_bail = true )
  15. public check_database_version()
  16. protected check_safe_collation( $query )
  17. public close()
  18. public db_connect( $allow_bail = true )
  19. public db_server_info()
  20. public db_version()
  21. public delete( $table, $where, $where_format = null )
  22. public determine_charset( $charset, $collate )
  23. public esc_like( $text )
  24. public escape( $data )
  25. public escape_by_ref( &$string )
  26. public flush()
  27. public get_blog_prefix( $blog_id = null )
  28. public get_caller()
  29. public get_charset_collate()
  30. public get_col( $query = null, $x = 0 )
  31. public get_col_charset( $table, $column )
  32. public get_col_info( $info_type = 'name', $col_offset = -1 )
  33. public get_col_length( $table, $column )
  34. public get_results( $query = null, $output = OBJECT )
  35. public get_row( $query = null, $output = OBJECT, $y = 0 )
  36. protected get_table_charset( $table )
  37. protected get_table_from_query( $query )
  38. public get_var( $query = null, $x = 0, $y = 0 )
  39. public has_cap( $db_cap )
  40. public hide_errors()
  41. public init_charset()
  42. public insert( $table, $data, $format = null )
  43. protected load_col_info()
  44. public log_query( $query, $query_time, $query_callstack, $query_start, $query_data )
  45. public parse_db_host( $host )
  46. public placeholder_escape()
  47. public prepare( $query, ...$args )
  48. public print_error( $str = '' )
  49. protected process_field_charsets( $data, $table )
  50. protected process_field_formats( $data, $format )
  51. protected process_field_lengths( $data, $table )
  52. protected process_fields( $table, $data, $format )
  53. public query( $query )
  54. public remove_placeholder_escape( $query )
  55. public replace( $table, $data, $format = null )
  56. public select( $db, $dbh = null )
  57. public set_blog_id( $blog_id, $network_id = 0 )
  58. public set_charset( $dbh, $charset = null, $collate = null )
  59. public set_prefix( $prefix, $set_table_names = true )
  60. public set_sql_mode( $modes = array() )
  61. public show_errors( $show = true )
  62. protected strip_invalid_text( $data )
  63. public strip_invalid_text_for_column( $table, $column, $value )
  64. protected strip_invalid_text_from_query( $query )
  65. public supports_collation()
  66. public suppress_errors( $suppress = true )
  67. public tables( $scope = 'all', $prefix = true, $blog_id = 0 )
  68. public timer_start()
  69. public timer_stop()
  70. public update( $table, $data, $where, $format = null, $where_format = null )

Changelog

Since 0.71 Introduced.

Code of wpdb{} WP 5.9.3

The code is too large. See it here: wp-includes/wp-db.php