Skip to content
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

Allow newline chars in CSV headers in MySQL Import service #3719

Merged
merged 9 commits into from
Jan 18, 2022

Conversation

clayliddell
Copy link
Contributor

@clayliddell clayliddell commented Nov 30, 2021

fixes WCMS-7337

  • Test coverage exists
  • Documentation exists

QA Steps

  • Create a dataset with a CSV file containing newlines in it's headers.
  • Ensure the dataset imports correctly.

@clayliddell clayliddell marked this pull request as draft December 1, 2021 15:16
@clayliddell clayliddell marked this pull request as ready for review January 14, 2022 20:28
Copy link
Member

@dafeder dafeder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple suggestions on code standards

// Call `count` on database table in order to ensure a database table has
// been created for the datastore.
// @todo Find a better way to ensure creation of datastore tables.
$this->dataStorage->count();
// Construct and execute a SQL import statement using the information
// gathered from the CSV file being imported.
$this->getDatabaseConnectionCapableOfDataLoad()->query(
$this->getSqlStatement($file_path, $this->dataStorage->getTableName(), $headers, $eol));
$this->getSqlStatement($file_path, $this->dataStorage->getTableName(), $headers, $eol, $header_line_count));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$this->getSqlStatement($file_path, $this->dataStorage->getTableName(), $headers, $eol, $header_line_count));
$this->getSqlStatement($file_path, $headers, $eol, $header_line_count));

CodeClimate's complaining about too many arguments, and this can be done inside the method.

Co-authored-by: Dan Feder <dan.feder@civicactions.com>
@dafeder dafeder merged commit 28723a6 into 2.x Jan 18, 2022
@clayliddell clayliddell deleted the use-mysql-import-fgetcsv branch January 18, 2022 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants