Re: New PostgreSQL functions

From: Date: Mon, 08 Apr 2002 13:15:28 +0000
Subject: Re: New PostgreSQL functions
References: 1 2  Groups: php.db 
Request: Send a blank email to php-db+get-18317@lists.php.net to get a copy of this message
I need to simple way to insert zval which has array type into PostgreSQL table. (I need to check/convert then insert) Python has similar API for PostgreSQL. (insert/update/delete/select) I've wrote it in C that do the same thing, so I added module functions do the same. ------------ $fields = pg_convert($db, 'some_table', $_POST); pg_insert($db, 'some_table', $fields); ------------ It's secure and much faster. Any loop in script is very slooooow and PHP need much more time to do the same with script implementation. That's all. There will never be pg_select_join, etc. Adam Voigt wrote:
I'm just curious is the purpose of these functions to remove the requirement that programmers know SQL? I'm not trying to sound sarcastic or anything, but I mean, whats next a pgsql_select_join for joins? If someones smart enough to figure out the Postgres install and performance tuning (and I know my first time was quite a rollercoaster of pain), why would you need to try and simplify it's use when a all powerful, all knowing, all doing pgsql_query would work? I'm mainly just wondering because sometimes my windows counterparts (who write in ASP or iHTML) think it's funny PHP has so many ways to do certain things, and so few ways to do other things. =)
Oh no. You are saying PHP is like a PERL. PHP stands for "People Hate PERL". (Just kidding, I like PERL and other developers like PERL) -- Yasuo Ohgaki
Just Curious, Adam Voigt adam.voigt@cryptocomm.com On Mon, 08 Apr 2002 13:41:46 +0900, Yasuo Ohgaki <yasuo_ohgaki@yahoo.com> wrote:
Hi, I've added new PostgreSQL functions to CVS. -------------------------------------------------------------------- array pg_metadata(resource db, string table) Get metadata -------------------------------------------------------------------- array pg_convert(resource db, string table, array values) Check and convert values for PostgreSQL SQL statement It escapes and add quotes around values accoding to metadata (i.e. Table Definition) -------------------------------------------------------------------- bool pg_insert(resource db, string table, array values[, bool convert[, bool async]]) Insert values (field=>value) to table -------------------------------------------------------------------- bool pg_update(resource db, string table, array fields, array ids[, bool convert[, bool asy nc]]) Update table using values (field=>value) and ids (id=>value) -------------------------------------------------------------------- bool pg_delete(resource db, string table, array ids[, bool convert[, bool async]]) Delete records has ids (id=>value) -------------------------------------------------------------------- array pg_select(resource db, string table, array ids[, bool convert]) Select records that has ids (id=>value) -------------------------------------------------------------------- They will be available for PHP 4.3.0. Please refer to test files under ext/pgsql/tests/ for usage. If you use PHP 4.1.x or above, you can replace old PostgreSQL module by new one. There are many new functions that will be avaiable in PHP 4.2.0 also. Bug reports and comments are welcome. Enjoy. -- Yasuo Ohgaki yohgaki@php.net -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.db (#18317) next »