feat: add unbuffered mode, insert tablename remove ``#36
Open
jjasoncool wants to merge 2 commits intolincanbin:masterfrom
Open
feat: add unbuffered mode, insert tablename remove ``#36jjasoncool wants to merge 2 commits intolincanbin:masterfrom
jjasoncool wants to merge 2 commits intolincanbin:masterfrom
Conversation
jjasoncool
commented
Dec 1, 2020
| $keys = array_keys($params); | ||
| $rowCount = $this->query( | ||
| 'INSERT INTO `' . $tableName . '` (`' . implode('`,`', $keys) . '`) | ||
| 'INSERT INTO ' . $tableName . ' (`' . implode('`,`', $keys) . '`) |
Contributor
Author
There was a problem hiding this comment.
- Insert
schema.tablewill show error exception.
If the program across two db.
When use$db->insert('db2.table', para);
PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'db.db2.table' doesn't exist.
If remove `` these quotes, I don't need to add new DB(Host, DBPort, **another_db_name**, DBUser, DBPassword) to solve this problem.
But I don't know if this is a good practice.
jjasoncool
commented
Dec 1, 2020
Comment on lines
+214
to
+224
| /** | ||
| * mysql unbuffered mode, suitable for reading huge data source | ||
| * @see https://www.php.net/manual/en/mysqlinfo.concepts.buffering.php | ||
| * | ||
| * @return void | ||
| */ | ||
| public function unbuffered() | ||
| { | ||
| $this->pdo->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false); | ||
| } | ||
|
|
Contributor
Author
There was a problem hiding this comment.
- buffered mode is used to read/write huge data.
See https://www.php.net/manual/en/mysqlinfo.concepts.buffering.php
I think there is no need to add setAttribute() method to this class.
So I add a function that can set connection to unbuffered mode.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
schema.tablewill show error exception.