PDO Auto-Smoothes When Extracted?

I have the following two tables:

Foo:

ID     NUMBER(38)
DATA   VARCHAR2(10)

bar

ID     NUMBER(38)
FOO_ID NUMBER(38)
DATA   VARCHAR2(10)

When using, the PDOfollowing request is issued:

SELECT * FROM foo f INNER JOIN bar b ON (f.id = b.foo_id)

Is there a way to return all columns from the connection in some kind of automatic smoothed format (for example, "FOO.ID", "FOO.DATA", "BAR.ID", etc.) so that I do not need to specify the alias of each single column in query?

I read all the documentation on the various receiving modes and experimented with most of the flags / options , but still can't find what I'm looking for.

Update:

Using PDO::FETCH_ASSOC, the columns from fooseem to be overwritten by columns from bar:

array(3) {
  ["ID"]=>
  string(1) "1"
  ["DATA"]=>
  string(5) "bar 1"
  ["FOO_ID"]=>
  string(1) "1"
}

PDO::FETCH_NUM, foo bar , , , , ( ):

array(5) {
  [0]=>
  string(1) "1"
  [1]=>
  string(5) "foo 1"
  [2]=>
  string(1) "1"
  [3]=>
  string(1) "1"
  [4]=>
  string(5) "bar 1"
}

PDO::FETCH_BOTH, , , , PDO::FETCH_ASSOC PDO::FETCH_NUM, :

array(8) {
  ["ID"]=>
  string(1) "1"
  [0]=>
  string(1) "1"
  ["DATA"]=>
  string(5) "bar 1"
  [1]=>
  string(5) "foo 1"
  [2]=>
  string(1) "1"
  ["FOO_ID"]=>
  string(1) "1"
  [3]=>
  string(1) "1"
  [4]=>
  string(5) "bar 1"
}

, :

array(5) {
  ["FOO.ID"]=>
  string(1) "1"
  ["FOO.DATA"]=>
  string(5) "foo 1"
  ["BAR.ID"]=>
  string(1) "1"
  ["BAR.FOO_ID"]=>
  string(1) "1"
  ["BAR.DATA"]=>
  string(5) "bar 1"
}
+5
3

, . - .

+1

, , , :

SELECT f.*, b.* FROM foo f INNER JOIN bar b ON (f.id = b.foo_id)
+2

:

SELECT f.ID as fID, f.DATA as fDATA, b.*, FROM foo f INNER JOIN bar b ON (f.id = b.foo_id)

the idea is to change only conflicting attributes so that there are no more conflicts.

0
source

All Articles