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

Add select_db as an alias for change_db #101

Merged

Commits on Jul 14, 2023

  1. Add select_db as an alias for change_db

    `select_db` is the method name in the mysql2 gem and also seems to be
    the preferred nomenclature in the [mysql documentation](https://dev.mysql.com/doc/c-api/5.7/en/mysql-select-db.html).
    
    AFAICT, both use `COM_INIT_DB` under the hood. Having `select_db` as an
    alias will make it easier to transition from `mysql2` -> `trilogy` (even
    if this likely isn't used _that_ frequently)
    
    There seems to be no noticable performance penalty for using the alias,
    at least with Ruby 3.2.2:
    
    ```
    ruby 3.2.2 (2023-03-30 revision e51014f9c0) [arm64-darwin22]
    Warming up --------------------------------------
                  native     1.260M i/100ms
                   alias     1.265M i/100ms
    Calculating -------------------------------------
                  native     12.583M (± 1.0%) i/s -     63.025M in   5.009167s
                   alias     12.538M (± 1.0%) i/s -     63.257M in   5.045579s
    
    Comparison:
                  native: 12583154.1 i/s
                   alias: 12538412.7 i/s - same-ish: difference falls within error
    ```
    HeyNonster committed Jul 14, 2023
    Configuration menu
    Copy the full SHA
    d728293 View commit details
    Browse the repository at this point in the history