Skip to content
This repository has been archived by the owner on Sep 20, 2021. It is now read-only.

New feature : enclose names #7

Closed
guiled opened this issue Jan 16, 2014 · 8 comments
Closed

New feature : enclose names #7

guiled opened this issue Jan 16, 2014 · 8 comments

Comments

@guiled
Copy link
Member

guiled commented Jan 16, 2014

Is it possible to think about the name enclosing in SQL?
Mysql can use name
Oracle uses "name"
SQL Server handles names like [this]
...

A good topic :
http://stackoverflow.com/questions/10573922/what-does-the-sql-standard-say-about-usage-of-backtick

@Hywan
Copy link
Member

Hywan commented Jan 17, 2014

Hello :-),

Here is our position. SQL is a language, with reserved keywords. The user must not use a reserved keywords in its schema, in order to not being in conflict with the SQL language.
Why? Because each DB has its own workaround, and Hoa\Database is not intented to abstract or to fill their oddities. Hoa\Database, for now, contains two things: a DBAL and a query builder. The query builder constructs queries regarding the SQL-2 standard, without any context (specificities of each DB). That's it.

Nevertheless, if a study shows that one of few common patterns/workarounds exist and are simple to implement, we can review our position. Please, motivate it on the mailing-lists or IRC if you think it is needed.

Thoughts?

@osaris
Copy link
Member

osaris commented Jan 17, 2014

@Hywan +1

I'm writing SQL queries everyday on MySQL, PostgreSQL, SQL Anywhere and I never enclose my field names because my databases schemas don't include reserved keywords.

@guiled
Copy link
Member Author

guiled commented Jan 17, 2014

The feature is not "allow to use keyword as identifier", but enclose identifiers.
Nevertheless I close this useless issue

Sorry :-/

@guiled guiled closed this as completed Jan 17, 2014
@Hywan
Copy link
Member

Hywan commented Jan 17, 2014

@guiled: Why “sorry” :-)? Does enclose identifiers is different as using keywords as identifiers? Maybe we miss something?

@Hywan
Copy link
Member

Hywan commented Jan 17, 2014

… or, we could enclose names each time, and the symbol would be parameterizable (e.g. setEncloseSymbol). What do you think?

@guiled
Copy link
Member Author

guiled commented Jan 17, 2014

I have made lot of mistake in this issue like "not having talked about it before" and forget to precise my thoughts.
I was thinking of an optional behaviour for enclosing identifiers, not a feature that encloses everything everytime (that is crappy).
So your method is perfect I guess...

@guiled guiled reopened this Jan 17, 2014
@guiled
Copy link
Member Author

guiled commented Jan 17, 2014

This idea is like you purpose so : a method called setEnclosedSymbol($openSymbol, $closeSymbol = null) that will make all identifier (table name, column name, aliases) in a SQL enclosed between symbols.
This thing is mandatory for names that are like "sql reserved keyword", but can be "nice" for other case.

This is not a prior critic feature.

@Hywan
Copy link
Member

Hywan commented Mar 27, 2015

ping? What is the state of this issue?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

3 participants