Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document db.php #11

Open
schlessera opened this issue Jun 9, 2017 · 2 comments
Open

Document db.php #11

schlessera opened this issue Jun 9, 2017 · 2 comments

Comments

@schlessera
Copy link
Member

No description provided.

@Lewiscowles1986
Copy link

wp-db.php wpdb class (what your presentation on WordPress.tv showed db.php extending) I have the following interface notes (should someone want to completely go without wpdb). What additional documentation is needed, and where should it live?

interface WordPressDBInterface implements  {
    public function __construct( $dbuser, $dbpassword, $dbname, $dbhost );
    public function __destruct();
    public function __get( $name );
    public function __set( $name, $value );
    public function __isset( $name );
    public function __unset( $name );
    public function init_charset();
    public function determine_charset( $charset, $collate );
    public function set_charset( $dbh, $charset = null, $collate = null );
    public function set_sql_mode( $modes = array() );
    public function set_prefix( $prefix, $set_table_names = true );
    public function set_blog_id( $blog_id, $site_id = 0 );
    public function get_blog_prefix( $blog_id = null );
    public function tables( $scope = 'all', $prefix = true, $blog_id = 0 );
    public function select( $db, $dbh = null );
    function _weak_escape( $string ); // probably protected or private method by definition of single underscore
    function _real_escape( $string ); // probably protected or private method by definition of single underscore
    public function _escape( $data );
    public function escape( $data );
    public function escape_by_ref( &$string );
    public function prepare( $query, $args );
    public function esc_like( $text );
    public function print_error( $str = '' );
    public function show_errors( $show = true );
    public function hide_errors();
    public function suppress_errors( $suppress = true );
    public function flush();
    public function db_connect( $allow_bail = true );
    public function check_connection( $allow_bail = true );
    public function query( $query );
    public function insert( $table, $data, $format = null );
    public function replace( $table, $data, $format = null );
    function _insert_replace_helper( $table, $data, $format = null, $type = 'INSERT' ); // probably protected or private method by definition of single underscore
    public function update( $table, $data, $where, $format = null, $where_format = null );
    public function delete( $table, $where, $where_format = null );
    public function get_var( $query = null, $x = 0, $y = 0 );
    public function get_row( $query = null, $output = OBJECT, $y = 0 );
    public function get_col( $query = null , $x = 0 );
    public function get_results( $query = null, $output = OBJECT );
    public function get_col_charset( $table, $column );
    public function get_col_length( $table, $column );
    public function strip_invalid_text_for_column( $table, $column, $value );
    public function get_col_info( $info_type = 'name', $col_offset = -1 );
    public function timer_start();
    public function timer_stop();
    public function bail( $message, $error_code = '500' );
    public function close();
    public function check_database_version();
    public function supports_collation();
    public function get_charset_collate();
    public function has_cap( $db_cap );
    public function get_caller();
    public function db_version();
}

@Lewiscowles1986
Copy link

Lewiscowles1986 commented Jun 24, 2017

Also the following functions have the following filter hooks. This could be important for plugins working with wpdb

public function set_sql_mode( $modes = array() ) {
    $incompatible_modes = (array) apply_filters( 'incompatible_sql_modes', $this->incompatible_modes );
}
public function query( $query ) {
    $query = apply_filters( 'query', $query );
}
protected function get_table_charset( $table ) {
    $charset = apply_filters( 'pre_get_table_charset', null, $table );
}
public function get_col_charset( $table, $column ) {
    $charset = apply_filters( 'pre_get_col_charset', null, $table, $column );
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants