diff options
author | Anatol Belski <ab@php.net> | 2014-02-17 10:21:59 +0100 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2014-02-17 10:21:59 +0100 |
commit | 3d1d48a85f4418968f69cd02c59736a25d2b422b (patch) | |
tree | 338a15a7a3d837320b1411501068339c226bd54f | |
parent | 24092b7196653b780abf7e420423836df8592751 (diff) | |
parent | 6877af3f7138d5c7c125c7f1c058e3661772240c (diff) | |
download | php-git-3d1d48a85f4418968f69cd02c59736a25d2b422b.tar.gz |
Merge branch 'PHP-5.6'
* PHP-5.6:
simplify the metadata part
-rw-r--r-- | ext/pgsql/pgsql.c | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index 822dae8de7..bd9a3f6f11 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -5254,30 +5254,18 @@ PHP_PGSQL_API int php_pgsql_meta_data(PGconn *pg_link, const char *table_name, z /* pg_attribute.attlen */ add_assoc_long(elem, "len", atoi(PQgetvalue(pg_result,i,3))); /* pg_attribute.attnonull */ - !strcmp(PQgetvalue(pg_result,i,4), "t") ? - add_assoc_bool(elem, "not null", 1) : - add_assoc_bool(elem, "not null", 0); + add_assoc_bool(elem, "not null", !strcmp(PQgetvalue(pg_result,i,4), "t")); /* pg_attribute.atthasdef */ - !strcmp(PQgetvalue(pg_result,i,5), "t") ? - add_assoc_bool(elem, "has default", 1) : - add_assoc_bool(elem, "has default", 0); + add_assoc_bool(elem, "has default", !strcmp(PQgetvalue(pg_result,i,5), "t")); /* pg_attribute.attndims */ add_assoc_long(elem, "array dims", atoi(PQgetvalue(pg_result,i,6))); /* pg_type.typtype */ - !strcmp(PQgetvalue(pg_result,i,7), "e") ? - add_assoc_bool(elem, "is enum", 1) : - add_assoc_bool(elem, "is enum", 0); + add_assoc_bool(elem, "is enum", !strcmp(PQgetvalue(pg_result,i,7), "e")); if (extended) { /* pg_type.typtype */ - !strcmp(PQgetvalue(pg_result,i,7), "b") ? - add_assoc_bool(elem, "is base", 1) : - add_assoc_bool(elem, "is base", 0); - !strcmp(PQgetvalue(pg_result,i,7), "c") ? - add_assoc_bool(elem, "is composite", 1) : - add_assoc_bool(elem, "is composite", 0); - !strcmp(PQgetvalue(pg_result,i,7), "p") ? - add_assoc_bool(elem, "is pesudo", 1) : - add_assoc_bool(elem, "is pesudo", 0); + add_assoc_bool(elem, "is base", !strcmp(PQgetvalue(pg_result,i,7), "b")); + add_assoc_bool(elem, "is composite", !strcmp(PQgetvalue(pg_result,i,7), "c")); + add_assoc_bool(elem, "is pesudo", !strcmp(PQgetvalue(pg_result,i,7), "p")); /* pg_description.description */ add_assoc_string(elem, "description", PQgetvalue(pg_result,i,8), 1); } |