修改 Pix_Table 的 MySQL adapter 以正確產生資料表#21
Open
yookoala wants to merge 3 commits intoronnywang:masterfrom
Open
Conversation
1. 原裝的 Pix_Table_Db_Adapter_MysqlCommon::createTable 不支援
longtext 資料類型產生資料表,而會將相關欄目宣告為 text。
由於 text 的長度太知,不適合我們使用,較早前改為 longtext 的
資料表宣告並未生較。所以現在將 longtext 加入為該 adapter 的
可支援類型。
2. 原裝 Pix_Table_Db_Adapter_MysqlCommon::createTable 並沒有指明
資料表的編碼類型,許多 MySQL 資料庫預設會用 latin1,這並不能正
確接收中文網站的原始資料。部份中文網站用的冷僻字,需要用到統一
碼的 4 byte 範圍,連正常的 UTF8 編碼也不足以處理。
修改後的 createTable 自動將資料表預設編碼設定為 "utf8mb4",能
正確處理上述情況。
原有方法直接用 SQL 語句產生表格,表格的結構不能隨 Pix_Table 實現而改變,比較不靈活。 改用 Ronny 在[這裏](https://github.com/ronnywang/newsdiff/issues/18#issuecomment-59484616)提及的方法產生 news_raw 表格。
新安裝時,table-build.php 的 drop table 指令執行失敗,結果阻礙程式進行。 修改後會偵測錯誤訊息,若果屬於 Unknown Table,則會自動無視。
4c569e7 to
b73989a
Compare
Author
|
這些是相對簡單的修訂,希望能夠採用。如有需要修改,請告知,會盡快修正。 |
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.
原裝的 Pix_Table_Db_Adapter_MysqlCommon::createTable 不支援
longtext 資料類型產生資料表,而會將相關欄目宣告為 text。
由於 text 的長度太知,不適合我們使用,較早前改為 longtext 的
資料表宣告並未生較。所以現在將 longtext 加入為該 adapter 的
可支援類型。
原裝 Pix_Table_Db_Adapter_MysqlCommon::createTable 並沒有指明
資料表的編碼類型,許多 MySQL 資料庫預設會用 latin1,這並不能正
確接收中文網站的原始資料。部份中文網站用的冷僻字,需要用到統一
碼的 4 byte 範圍,連正常的 UTF8 編碼也不足以處理。
修改後的 createTable 自動將資料表預設編碼設定為 "utf8mb4",能
正確處理上述情況。
改進 new-raw-tables.php
修正 table-build.php 首次執行的問題