Giter Club home page Giter Club logo

database's People

Contributors

grummfy avatar guiled avatar hywan avatar korbeil avatar metalaka avatar osaris avatar shulard avatar stephpy avatar vonglasow avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

database's Issues

Alias syntax in FROM clause

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?

Handle bindParam and bindValue methods

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.

PDO + SQLite + CURSOR_SCROLL failed

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?

Alias in FROM clause.

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.

  • For the Foo table I can make an alias without the keyword AS like from('Foo F').
  • The second alias is not well placed due to the 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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.