Re: [PHP-DB] New PostgreSQL functions
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. =) Just Curious, Adam Voigt [EMAIL PROTECTED] On Mon, 08 Apr 2002 13:41:46 +0900, Yasuo Ohgaki [EMAIL PROTECTED] 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 [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] New PostgreSQL functions
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 slow 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 [EMAIL PROTECTED] On Mon, 08 Apr 2002 13:41:46 +0900, Yasuo Ohgaki [EMAIL PROTECTED] 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 [EMAIL PROTECTED] -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] New PostgreSQL functions
Adam Voigt wrote: think it's funny PHP has so many ways to do certain things, and so few ways to do other things. =) I forgot to ask. May I ask what kind of features/functions are missing? It does not have to be about PostgreSQL module. -- Yasuo Ohgaki -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re: [PHP-DB] New PostgreSQL functions
Well since I've programmed in PHP for a while, I think PHP is quite capable in damn near all of the possible programming areas. But for instance, here are some of their complaints: 1. Weak PHP-Internal Date Manipulation Functions, on certain sites we do quite a bit of non-sql based date manipulation and certain functions which are sql based (and there are functional counterparts for other languages) that are missing from PHP. 2. Weak Error Handling, We could not get the custom error handling to work except when using the trigger_error function, which is useless if an error is caused somewhere theres not an or die(trigger_error()). Essentially what they want is called an error block on iHTML which essentially sends a copy of all errors on that page to a specified email address along with a dump of all the standard arrays like $_POST, and $_GET, and if we could get custom error handling to work, I'm sure we could write this in, but after a week of just trying to get that to work, we were unsuccessful. Also, on some occasions, even with error_reporting set to E_ALL, a missing quote or } would make PHP just show a completely blank white page instead of an error like unterminated function, etc. They also don't like that they have to put or die(mssql_get_last_message()) after every query where in other languages it would automatically stop execution of the page and throw the error the database returned to the page. And just to let you know, you should have seen there eye's light up with glee at me explaining the explode and implode functions, as they were not used to being able to use arrays in situations where they would fit so perfectly, with other languages which handled them clunkily at best. This is just one example of all the positives they found to the PHP language, and I certainly don't want you to think me a ASP zealot because I don't program in ASP or iHTML for that matter, I'm a pure PHP evangelist from top to bottom. Adam Voigt [EMAIL PROTECTED] On Mon, 08 Apr 2002 23:04:25 +0900, Yasuo Ohgaki [EMAIL PROTECTED] wrote: Adam Voigt wrote: think it's funny PHP has so many ways to do certain things, and so few ways to do other things. =) I forgot to ask. May I ask what kind of features/functions are missing? It does not have to be about PostgreSQL module. -- Yasuo Ohgaki -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] New PostgreSQL functions
Adam Voigt wrote: Well since I've programmed in PHP for a while, I think PHP is quite capable in damn near all of the possible programming areas. But for instance, here are some of their complaints: 1. Weak PHP-Internal Date Manipulation Functions, on certain sites we do quite a bit of non-sql based date manipulation and certain functions which are sql based (and there are functional counterparts for other languages) that are missing from PHP. Date manupulation is headache. We do need advanced one. PEAR developers are trying to provide better one. 2. Weak Error Handling, We could not get the custom error PHP5 has try, catch. However, there are many rooms for improvements... in ASP or iHTML for that matter, I'm a pure PHP evangelist from top to bottom. :) -- Yasuo Ohgaki Adam Voigt [EMAIL PROTECTED] On Mon, 08 Apr 2002 23:04:25 +0900, Yasuo Ohgaki [EMAIL PROTECTED] wrote: Adam Voigt wrote: think it's funny PHP has so many ways to do certain things, and so few ways to do other things. =) I forgot to ask. May I ask what kind of features/functions are missing? It does not have to be about PostgreSQL module. -- Yasuo Ohgaki -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php