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

Reconstruct statement #136

Open
mtangoo opened this issue Dec 9, 2019 · 4 comments
Open

Reconstruct statement #136

mtangoo opened this issue Dec 9, 2019 · 4 comments

Comments

@mtangoo
Copy link

mtangoo commented Dec 9, 2019

Hi,
thank you for this wonderful library. I just started today an am already enjoying using it.
I have a use case where I have statement like
SELECT a,b,c FROM users WHERE a > 1

Now suppose I want to reconstruct the SQL query string removing WHERE and replacing Select columns with let say * so that the statement becomes:
SELECT * FROM users

I know the library provides a list of statements (where I can choose which one I don't want to have them but then how do I glue the wanted pieces into a complete statement?

TIA,
Stefano

@mrks
Copy link
Member

mrks commented Dec 10, 2019

Hi Stefano,

glad that the library is of use to you. Just to clarify: Is your expected output another SQL statement? If yes, that is not something that we support at the moment.

It should not be too complex to add operator<< methods to the different classes and recreate a SQL statement. Once that is done, actually replacing the columns (SelectStatement::selectList) with a single * is straight forward.

@mtangoo
Copy link
Author

mtangoo commented Dec 10, 2019

Hi,
I don't expect full statement but rather building blocks. For example from Select I can get the table and columns. That's enough to build Select statement. In where I could get conditions, et al.

Are those things available already (I know I can get the table from one issue I found on repo)

@mrks
Copy link
Member

mrks commented Dec 11, 2019

I know I can get the table from one issue I found on repo

Could you give me a link? Maybe that will help me understand better what you are looking for.

@mtangoo
Copy link
Author

mtangoo commented Dec 11, 2019

OK I will put exhaustive explanation when at home!

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

No branches or pull requests

2 participants