Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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') ;`