# shardingsphere-driver-example **Repository Path**: raigor/shardingsphere-driver-example ## Basic Information - **Project Name**: shardingsphere-driver-example - **Description**: Example of ShardingSphereDriver - **Primary Language**: Java - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2023-12-05 - **Last Updated**: 2025-04-28 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # shardingsphere-driver-example ### quick start 1. 配置 application-*.yaml 文件 2. 运行 TestCommonSQLService ### rest api 测试 1. SELECT ```shell curl -H "Content-Type:application/json" -d "{\"sql\": \"select * from t_membership_order\"}" -X POST http://127.0.0.1:8888/common-sql/select ``` 2. INSERT ```shell curl -X POST -H "Content-Type:application/json" http://127.0.0.1:8888/common-sql/insert -d '{"sql": "INSERT INTO t_user(id, username, email) VALUES (5,\"Sky\",\"sky@gmail.com\")"}' ``` 3. UPDATE ```shell curl -X POST -H "Content-Type:application/json" http://127.0.0.1:8888/common-sql/update -d '{"sql": "UPDATE t_user SET email = \"sky@sphere-ex.com\" WHERE id = 5"}' ``` 4. DELETE ```shell curl -X POST -H "Content-Type:application/json" http://127.0.0.1:8888/common-sql/delete -d '{"sql": "DELETE FROM t_user WHERE id = 5"}' ``` 5. DDL ```shell curl -X POST -H "Content-Type:application/json" http://127.0.0.1:8888/common-sql/ddl -d '{"sql": "TRUNCATE TABLE t_user"}' ``` > DDL 接口可用于执行 CREATE TABLE、DROP TABLE、TRUNCATE 等语句 # TODO 补充其他 SQL 示例 # https://u01f1kqxrl.feishu.cn/docx/MerGd9iFhoBEbHxOAb9cqHUYnud ### 定时请求 每 2 秒请求一次 ```shell watch -n 2 'curl -H "Content-Type:application/json" -d "{\"sql\": \"select * from t_membership_order\"}" -X POST http://127.0.0.1:8888/common-sql/select' ```