Skip to content
New issue

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

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

Already on GitHub? # to your account

Auto adding Ticks #181

Open
php- opened this issue May 30, 2019 · 8 comments
Open

Auto adding Ticks #181

php- opened this issue May 30, 2019 · 8 comments

Comments

@php-
Copy link

php- commented May 30, 2019

This is so annoying, for example using: @@session.time_zone will add ticks to session and time_zone, like this @@`session`.`time_zone`. Is there a way I can disable this feature?
This also happens if you use count(distinct x) and many more cases.

@php-
Copy link
Author

php- commented Jul 12, 2019

@harikt @pmjones please can you take look at this?

@harikt
Copy link
Member

harikt commented Jul 12, 2019

Hi @php- ,

I am wondering how you are using @@session.time_zone . Is this a field ? Can you show exact issue on a Pull request how you are using the feature.

I can't promise I will fix it, but I can look into it.

@php-
Copy link
Author

php- commented Jul 12, 2019

For example: convert_tz(field, @@session.time_zone, to_desired_timezone), and this does not matter you use in selection or in where clause.

There are many different cases as I mentioned before like COUNT(DISTINCT field)), I think you should add config to enable/disable it. because they way it works, is really limiting some good features of SQL language.

Thanks

@koriym
Copy link
Member

koriym commented Jul 13, 2019

Hi @php-

It would be nice if you provide minimal, self-contained, reproducing test case that shows the problem you are reporting.

@harikt
Copy link
Member

harikt commented Jul 13, 2019

Hi @php- ,

I believe you can enable / disable it via setting the parser to NullParser .

// https://github.com/auraphp/Aura.Sql/tree/2be02d5dfd9fdee6df199de1a19572aa490bb744/src/Parser
$parser = new \Aura\Sql\Parser\NullParser();
$pdo->setParser($parser);

Remember once you unset to new parser you may want to set it again if you want to make sure other quoting related functionalities is working fine.

Hope that helps to resolve your issue / use case .

@francislavoie
Copy link

Is this still relevant? It seems to work fine now for me 🤔

image

image

@php-
Copy link
Author

php- commented Jun 25, 2023

@francislavoie yes, issue still exists. The query you run might not have issues, but when you use builder like:

$query = $queryFactory->newSelect();
$query->from("customer");
$query->cols(['convert_tz(open_from, customer.time_zone, @@session.time_zone) open_now']);
$query->where('customer.id=123');

@tbreuss
Copy link

tbreuss commented Jan 23, 2024

@francislavoie yes, issue still exists. The query you run might not have issues, but when you use builder like:

$query = $queryFactory->newSelect(); $query->from("customer"); $query->cols(['convert_tz(open_from, customer.time_zone, @@session.time_zone) open_now']); $query->where('customer.id=123');

Sorry, but your code example has no reference to aura/sql. There is no query builder in this package.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants