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

Cache table structure on PDO object #9

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mcaskill
Copy link
Member

@mcaskill mcaskill commented May 4, 2020

Similar to ac6f81d for table exists checks.

By remembering the table structure (for the duration of the request), we don't need to look it up each time we want to insert or update a row. Saves a little bit of time off mass-inserts/updates.

Note: Until alterTable() routines can be improved, the cached table structure is cleared whenever a change is made to the table schema.

Added:

  • Method setTableStructure() to store copy of table schema on PDO instance
  • Method queryTableStructure() to prepare and run actual table schema retrieval

Changed:

  • Method tableStructure() to delegate and remember lookup
  • Method `alterTable() to clear cached table structure

Similar to ac6f81d for table exists checks.

By remembering the table structure, we don't need to look it up each time we want to insert or update a row. Saves a little bit of time off mass-inserts/updates.

Until we can improve `alterTable()`, the cached table structure is cleared whenever a change is made to the table.

Added:
- Method `setTableStructure()` to store copy of table schema on PDO instance
- Method `queryTableStructure()` to prepare and run actual table schema retrieval

Changed:
- Method `tableStructure()` to delegate and remember lookup
- Method `alterTable() to clear cached table structure
@mcaskill mcaskill force-pushed the mcaskill-patch-table-structure branch from 00a6bd4 to 3561c6e Compare May 4, 2020 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant