Skip to content

Add method for execute SQL from file #118

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
vjik opened this issue Oct 16, 2021 · 4 comments
Open

Add method for execute SQL from file #118

vjik opened this issue Oct 16, 2021 · 4 comments

Comments

@vjik
Copy link
Member

vjik commented Oct 16, 2021

For example, $b->executeSqlFromFile().

Need to come up with a good name. Variants:

  • loadDump()
  • loadSql()
  • executeSqlFromFile()
  • executeSql()
@samdark
Copy link
Member

samdark commented Oct 18, 2021

@samdark
Copy link
Member

samdark commented Oct 18, 2021

It could be implemented in two ways:

  1. A method accepting a string with many SQL statements. File reading isn't involved and is done with file_get_contents. Not good for huge dumps.
  2. A method accepting a file path. There we can open a file and seek it till next SQL statement executing previous one. Would be memory efficient but could be a bit slow.

@Tigrov
Copy link
Member

Tigrov commented Nov 4, 2023

There is execute() method which executes SQL strings.

Name executeFile() looks good for executing SQL files.

The method should be added to CommandInterface and realized in AbstractCommand as execute() method.
After we can add a wrapper to MigrationBuilder

@vjik
Copy link
Member Author

vjik commented Nov 7, 2023

If this functionality is needed, then need to create issue in Yii DB.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants