diff options
author | Anatol Belski <ab@php.net> | 2014-02-17 10:20:36 +0100 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2014-02-17 10:20:36 +0100 |
commit | 6877af3f7138d5c7c125c7f1c058e3661772240c (patch) | |
tree | e9a2cf606ecf97c970f0e86e10ee0b05abfce8bb /ext/pgsql | |
parent | 796bfb0bd000f7d9d23e633a965f6a8a77a5e927 (diff) | |
download | php-git-6877af3f7138d5c7c125c7f1c058e3661772240c.tar.gz |
simplify the metadata part
Diffstat (limited to 'ext/pgsql')
-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); } |