hoaproject / database Goto Github PK
View Code? Open in Web Editor NEWThe Hoa\Database library.
Home Page: https://hoa-project.net/
The Hoa\Database library.
Home Page: https://hoa-project.net/
MySql throw a SQL syntax error when using from alias on a Select
request
#1064 - You have an error in your SQL syntax; check the manual
that corresponds to your MySQL server version for the right syntax
to use near 'o WHERE o.OBJ_ID = '…' ' at line 1
with request : SELECT OBJ_ID FROM (OBJECTS) AS o WHERE o.OBJ_ID = '…'
Why add parenthesis on line 223 of Hoa\Database\Query\SelectCore
? It work without.
$this->_from[$alias] = '(' . array_pop($this->_from) . ')';
I doesn't find examples with parenthesis on MySql and MsSql.
This is the syntax from mysql.com.
FROM tbl_name [[AS] alias]
I use MySql 5.5.
PS: there is no comma added between two FORM, this is because Hoa\Database is not finalized?
Please, see K-Phoen/php-sql-parser#1.
Thoughts?
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
PDO fails to detect the type of the variable passed to a binded parameter. We need to use bindParam or bindValue to force the good parameter type.
We should handle these two methods in Hoa\Database.
Hello :-),
Since our recent features on having iterators over result set, we force PDO::CURSOR_SCROLL
on an ATTR_CURSOR
. With SQLite, it failed with a null error. It seems to be an error from PDO but we have to fix it anyway.
Any idea how?
Hello,
I'm trying to use a Hoa\Database\Query\Select
object in an INNER JOIN
clause.
My goal is to get the following query:
SELECT *
FROM Foo AS F
INNER JOIN (
SELECT *
FROM Bar
) AS B
ON F.Foo_ID = B.Bar_ForeignKey
But I wasn't able to alias correctly my two sources.
Foo
table I can make an alias without the keyword AS
like from('Foo F')
.ON
clause (it's work well without).There are my test code and the output.
$req = new \Hoa\Database\Query\Select();
$req->from('Foo')
->_as('F')
->innerJoin(
(new \Hoa\Database\Query\Select())
->from('Bar')
)
->on('F.Foo_ID = B.Bar_ForeignKey')
->_as('B');
SELECT *
FROM Foo
INNER JOIN (
SELECT *
FROM Bar
)
ON F.Foo_ID = B.Bar_ForeignKey
AS B
PS: Moreover the fact to don't alias an Hoa\Database\Query\Select
object in an INNER JOIN
clause throw a SQL error : #1248 - Every derived table must have its own alias
.
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.