Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

PostgreSQL's PDOStatement::getColumnMeta() fills in table's name. #374

Closed
wants to merge 3 commits into from

Conversation

glubo
Copy link
Contributor

@glubo glubo commented Jul 2, 2013

http://www.php.net/manual/en/pdostatement.getcolumnmeta.php states that there should be column 'table' in returned array. That is not true in current implementation of pgsql_stmt_get_column_meta(). This patch gets table's oid and tries to translate it to table's name.

@yohgaki
Copy link
Contributor

yohgaki commented Jul 4, 2013

Quick comment in case someone would like to commit this.

  • spprintf(&querystr, 0, "select relname from pg_class where oid=%d", oid);

Oid is uint currently, so %d is not good.

@glubo
Copy link
Contributor Author

glubo commented Jul 4, 2013

I was unsure what % use with Oid, so I copied it from line of pgsql_stmt_get_column_meta():

  • spprintf(&q, 0, "SELECT TYPNAME FROM PG_TYPE WHERE OID=%d", S->cols[colno].pgsql_type);

So this line should be corrected too. What is correct % to use with Oid?

@weltling
Copy link
Contributor

weltling commented Jul 8, 2013

%u is the format for unsigned.

@yohgaki
Copy link
Contributor

yohgaki commented Jul 8, 2013

Hi Petr,

2013/7/4 Petr Sykora [email protected]

I was unsure what % use with Oid, so I copied it from line of
pgsql_stmt_get_column_meta():

  • spprintf(&q, 0, "SELECT TYPNAME FROM PG_TYPE WHERE OID=%d",
    S->cols[colno].pgsql_type);

So this line should be corrected too. What is correct % to use with Oid?

This should be %ud, I'll fix it later.
Thank you.

Yasuo Ohgaki
[email protected]

@weltling
Copy link
Contributor

@yohgaki %u stands for 'unsigned int', %d stands for 'int'. So 'u' isn't a modifier. %ud will append the char 'd' to that number, that is obviously not what's expected.

@yohgaki
Copy link
Contributor

yohgaki commented Jul 11, 2013

2013/7/10 Anatol Belski [email protected]

@yohgaki https://github.com/yohgaki %u stands for 'unsigned int', %d
stands for 'int'. So 'u' isn't a modifier. %ud will append the char 'd' to
that number, that is obviously not what's expected.

Oops. It should be %u.
Thank you.

Yasuo Ohgaki
[email protected]

@kaplanlior
Copy link
Contributor

@yohgaki - any more comments or this is ready for merge?

@glubo
Copy link
Contributor Author

glubo commented Sep 16, 2013

Is there anything else I can do to make this pull happen?

@weltling
Copy link
Contributor

weltling commented Apr 7, 2016

I've ported and merged it into 7.0 with aeb9c81, but seems the QA page cannot close this. This PR can be closed though.

Thanks.

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

Successfully merging this pull request may close these issues.

6 participants