Sharding-JDBC kernel-based database sub-library and sub-table insertion method
The invention relates to a database sub-library and sub-table insertion method based on a Sharding-JDBC kernel. Compared with the prior art, the defect that sub-library and sub-table insertion is difficult to achieve is overcome. The method comprises the following steps: intercepting an inserted sta...
Gespeichert in:
Hauptverfasser: | , , , , , , |
---|---|
Format: | Patent |
Sprache: | chi ; eng |
Schlagworte: | |
Online-Zugang: | Volltext bestellen |
Tags: |
Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
|
Zusammenfassung: | The invention relates to a database sub-library and sub-table insertion method based on a Sharding-JDBC kernel. Compared with the prior art, the defect that sub-library and sub-table insertion is difficult to achieve is overcome. The method comprises the following steps: intercepting an inserted statement; extracting a table to be inserted; rewriting the table T1 to be inserted; rewriting the secondary query statement sql2; performing traversal check on a rewriting result; and completing the insertion of the database sub-database sub-tables. According to the method, the data is directly inserted from one table to another table in the database through the insert select statement, so that the processing of reading the data from the database, converting the data into entity objects and then inserting the entity objects into the database is avoided.
本发明涉及一种基于Sharding-JDBC内核的数据库分库分表插入方法,与现有技术相比解决了难以实现分库分表插入的缺陷。本发明包括以下步骤:拦截插入语句;待插入表的提取;待插入表T1的改写;次查询语句sql2的改写;改写结果的遍历检查;数据库分库分表插入完成。本发明通过insert select语句直接将数据在数据库中从一张表插 |
---|