Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aliesmaeil/queries-in-file
converting multiple SQL queries located in a file into only one composite insert query
https://github.com/aliesmaeil/queries-in-file
dart query query-builder sql
Last synced: 20 days ago
JSON representation
converting multiple SQL queries located in a file into only one composite insert query
- Host: GitHub
- URL: https://github.com/aliesmaeil/queries-in-file
- Owner: AliEsmaeil
- Created: 2024-07-24T00:07:17.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-07-24T01:14:09.000Z (6 months ago)
- Last Synced: 2024-11-13T18:06:51.407Z (3 months ago)
- Topics: dart, query, query-builder, sql
- Language: Dart
- Homepage:
- Size: 9.77 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
## Converting Multiple Queries in File to Single Query
An example demonstrating a file containing many insert queries and converting them to single insert query:
Here's what i have put in the file(inserts.txt), exactly in a single line:
inserts.txt file
INSERT INTO article (id, name) VALUES (1, 'Banana') ;INSERT INTO article (id, name) VALUES (2, 'Orange') ;
INSERT INTO article (id, name) VALUES (3, 'Apple') ;
This demonstration is done using procedural programming (functional programming)
The result of that function is just a single `String` representing the content of the file or `null` if the file is not exist.
after all you need to get the accumulative query and pass it to your database Manager to insert them:
`INSERT INTO article (id, name) VALUES (1, 'Banana') ,(2, 'Orange') ,(3, 'Apple') ;`