Re: com php-src: simplify the metadata part: ext/pgsql/pgsql.c
| From: | Yasuo Ohgaki | Date: | Mon, 17 Feb 2014 09:57:55 +0000 |
| Subject: | Re: com php-src: simplify the metadata part: ext/pgsql/pgsql.c | ||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-76041@lists.php.net to get a copy of this message | ||
Oops. I just made "if" to "?:" Thank you!
--
Yasuo Ohgaki
yohgaki@ohgaki.net
On Mon, Feb 17, 2014 at 6:20 PM, Anatol Belski <ab@php.net> wrote:
> Commit: 6877af3f7138d5c7c125c7f1c058e3661772240c
> Author: Anatol Belski <ab@php.net> Mon, 17 Feb 2014 10:20:36
> +0100
> Parents: 796bfb0bd000f7d9d23e633a965f6a8a77a5e927
> Branches: PHP-5.6 master
>
> Link:
>
> http://git.php.net/?p=php-src.git;a=commitdiff;h=6877af3f7138d5c7c125c7f1c058e3661772240c
>
> Log:
> simplify the metadata part
>
> Changed paths:
> M ext/pgsql/pgsql.c
>
>
> Diff:
> diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
> index 822dae8..bd9a3f6 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);
> }
>
>
> --
> PHP CVS Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>