Skip to content

fix generate sql will be truncate when quote char in word#1402

Merged
bodiam merged 4 commits intodatafaker-net:mainfrom
shanjuren:bugfix_quote_in_word
Oct 26, 2024
Merged

fix generate sql will be truncate when quote char in word#1402
bodiam merged 4 commits intodatafaker-net:mainfrom
shanjuren:bugfix_quote_in_word

Conversation

@shanjuren
Copy link
Copy Markdown
Contributor

Some thesaurus`s word will be truncate when I use datafaker to generate SQL, like Address,Book... That reason is when SqlTransformer calling the handledObjectToString method will be one by one add char to new Object ,but if miss quote char will be stop.

@what-the-diff
Copy link
Copy Markdown

what-the-diff bot commented Oct 24, 2024

PR Summary

  • Revised String Construction Method
    Modified the method used to build strings in handledObjectToString. Transitioned from StringJoiner to StringBuilder, making the process more adaptable and efficient.
  • Streamlined Quote Handling
    Simplified how quotes within strings are managed, by eliminating the reliance on conditional check on joiner, enhancing the code's simplicity and readability.
  • Direct String Return
    Optimized the return process by directly returning the string that has been created with StringBuilder, promoting cleaner and more straightforward code.

asolntsev
asolntsev previously approved these changes Oct 24, 2024
Copy link
Copy Markdown
Collaborator

@asolntsev asolntsev left a comment

Choose a reason for hiding this comment

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

@shanjuren Could you please add a test? Probably in SqlTest.java

@codecov
Copy link
Copy Markdown

codecov bot commented Oct 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.30%. Comparing base (848dfe7) to head (70fa616).
Report is 8 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #1402      +/-   ##
============================================
+ Coverage     92.19%   92.30%   +0.11%     
- Complexity     3151     3153       +2     
============================================
  Files           319      319              
  Lines          6152     6149       -3     
  Branches        593      591       -2     
============================================
+ Hits           5672     5676       +4     
+ Misses          336      332       -4     
+ Partials        144      141       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@shanjuren
Copy link
Copy Markdown
Contributor Author

@shanjuren Could you please add a test? Probably in SqlTest.java

OK,i will try do it

@shanjuren
Copy link
Copy Markdown
Contributor Author

is done

@bodiam
Copy link
Copy Markdown
Contributor

bodiam commented Oct 26, 2024

I fixed up the PR, I'll merge it in.

@bodiam bodiam merged commit 8260c40 into datafaker-net:main Oct 26, 2024
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.

4 participants