Perl/PHP functionality in MySQL, PostgreSQL

Perl/PHP functionality in MySQL, PostgreSQL

This Content Component encountered an error
How different is Perl or PHP functionality in MySQL vs. PostgreSQL?

This question could mean one of two things. It might be, "How do I write Perl or PHP code that uses a MySQL or PostgreSQL database?" Or, it might be, "Is it possible to write functions and procedures in MySQL and PostgreSQL using Perl or PHP?" For the former, there are a few choices. PHP offers extensions specific to MySQL and to PostgreSQL, so you might write code using mysql_query or pg_query. You can also use PDO or ODBC to connect in a more or less database agnostic manner.

For the latter, PostgreSQL offers PL/Perl and PL/php, which allow you to write procedures in Perl and PHP. PL/Perl is currently more stable than PL/php.

With the aid of some user defined functions and a thread-safe compilation, it is possible to write functions for MySQL using Perl and PHP. See http://www.linuxjournal.com/article/6841 and http://www.sklar.com/page/article/myphp for details. It is possible that future versions of MySQL will allow a more "plug and play" approach to coding procedures in other languages.

This was first published in January 2007

Dig Deeper

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.



Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: