[PHP-DEV] FRC: pg_metadata, pg_convert, pg_insert, etc
Hi to all database module maintainers, I've committed some new PostgreSQL functions and manual pages for these. pg_metadata() - get medata data pg_convert() - check and convert array accoding to metadata pg_insert()/update()/select()/delete() - does insert, etc by array. With the new function, users can do safely. ?php $db = pg_connect(); pg_insert($db, 'get_value_log', $_GET) or user_sent_malformed_data(); ? Since, pg_insert() lookup metadata and convert array values safely used in SQL. Please take a look at API, since you or other person may implement same feature for your database in the future. And API should be consistent whenever it's possible. I can change API if it's before PHP 4.3.0. Thank you. -- Yasuo Ohgaki -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] FRC: pg_metadata, pg_convert, pg_insert, etc
Can you elaborate more on the mystic 'metadata' and what it reallt means to the functions? On Wed, Apr 10, 2002 at 04:43:21PM +0900, Yasuo Ohgaki wrote : Hi to all database module maintainers, I've committed some new PostgreSQL functions and manual pages for these. pg_metadata() - get medata data pg_convert() - check and convert array accoding to metadata pg_insert()/update()/select()/delete() - does insert, etc by array. With the new function, users can do safely. ?php $db = pg_connect(); pg_insert($db, 'get_value_log', $_GET) or user_sent_malformed_data(); ? Since, pg_insert() lookup metadata and convert array values safely used in SQL. Please take a look at API, since you or other person may implement same feature for your database in the future. And API should be consistent whenever it's possible. I can change API if it's before PHP 4.3.0. Thank you. -- Yasuo Ohgaki -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php -- Please always Cc to me when replying to me on the lists. GnuPG Key: http://guru.josefine.at/~mfischer/C2272BD0.asc Mind if I MFH ? What QA did you do on it? the usual? ah... none :) -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] FRC: pg_metadata, pg_convert, pg_insert, etc
sounds really nice.. would it be possible to accept objects as well as arrays? how does it know if the update column should be an integer or string - eg. '12' or 12 ? - is that what the meta data is for? regards alan Markus Fischer wrote: Can you elaborate more on the mystic 'metadata' and what it reallt means to the functions? On Wed, Apr 10, 2002 at 04:43:21PM +0900, Yasuo Ohgaki wrote : Hi to all database module maintainers, I've committed some new PostgreSQL functions and manual pages for these. pg_metadata() - get medata data pg_convert() - check and convert array accoding to metadata pg_insert()/update()/select()/delete() - does insert, etc by array. With the new function, users can do safely. ?php $db = pg_connect(); pg_insert($db, 'get_value_log', $_GET) or user_sent_malformed_data(); ? Since, pg_insert() lookup metadata and convert array values safely used in SQL. Please take a look at API, since you or other person may implement same feature for your database in the future. And API should be consistent whenever it's possible. I can change API if it's before PHP 4.3.0. Thank you. -- Yasuo Ohgaki -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] FRC: pg_metadata, pg_convert, pg_insert, etc
Markus Fischer wrote: Can you elaborate more on the mystic 'metadata' and what it reallt means to the functions? array pg_metadata(resource conn, string tablename); returns table definition stored in PostgreSQL system catlog. Returned array is array(3) { [num]= // field name array(5) { [num]= // field number int(1) [type]= // field type string(4) int4 [len]= // field length int(4) [not null]= // NOT NULL? bool(false) [default]= // have DEFAULT? bool(false) } [str]= array(5) { [num]= int(2) [type]= string(4) text [len]= int(-1) [not null]= bool(false) [default]= bool(false) } [bin]= array(5) { [num]= int(3) [type]= string(5) bytea [len]= int(-1) [not null]= bool(false) [default]= bool(false) } } where table is test=# \d php_pgsql_test Table php_pgsql_test Column | Type | Modifiers +-+--- num| integer | str| text| bin| bytea | pg_convert uses 'type' to check input and convert input array. I'll add not null check, change behavior at bit. Currently, it converts (null string) to NULL, but it will (null string). -- Yasuo Ohgaki On Wed, Apr 10, 2002 at 04:43:21PM +0900, Yasuo Ohgaki wrote : Hi to all database module maintainers, I've committed some new PostgreSQL functions and manual pages for these. pg_metadata() - get medata data pg_convert() - check and convert array accoding to metadata pg_insert()/update()/select()/delete() - does insert, etc by array. With the new function, users can do safely. ?php $db = pg_connect(); pg_insert($db, 'get_value_log', $_GET) or user_sent_malformed_data(); ? Since, pg_insert() lookup metadata and convert array values safely used in SQL. Please take a look at API, since you or other person may implement same feature for your database in the future. And API should be consistent whenever it's possible. I can change API if it's before PHP 4.3.0. Thank you. -- Yasuo Ohgaki -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php