Index: modules/php/php.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/php/php.install,v
retrieving revision 1.4
diff -u -p -r1.4 php.install
--- modules/php/php.install	21 Jan 2009 16:58:42 -0000	1.4
+++ modules/php/php.install	10 Mar 2009 21:13:40 -0000
@@ -5,17 +5,28 @@
  * Implementation of hook_install().
  */
 function php_install() {
-  $format_exists = db_result(db_query("SELECT COUNT(*) FROM {filter_format} WHERE name = 'PHP code'"));
+  $format_exists = db_query("SELECT COUNT(*) FROM {filter_format} WHERE name = 'PHP code'")->fetchField();
   // Add a PHP code text format, if it does not exist. Do this only for the
   // first install (or if the format has been manually deleted) as there is no
   // reliable method to identify the format in an uninstall hook or in
   // subsequent clean installs.
   if (!$format_exists) {
-    db_query("INSERT INTO {filter_format} (name, roles, cache) VALUES ('PHP code', '', 0)");
-    $format = db_result(db_query("SELECT MAX(format) FROM {filter_format}"));
+    $format = db_insert('filter_format')
+      ->fields(array(
+        'name' => 'PHP code',
+        'roles' => '',
+        'cache' => 0))
+      ->execute();
 
     // Enable the PHP evaluator filter.
-    db_query("INSERT INTO {filter} (format, module, delta, weight) VALUES (%d, 'php', 0, 0)", $format);
+    db_insert('filter')
+      ->fields(array(
+        'format' => $format,
+        'module' => 'php',
+        'delta' => 0,
+        'weight' => 0,
+      ))
+      ->execute();
 
     drupal_set_message(t('A !php-code text format has been created.', array('!php-code' => l('PHP code', 'admin/settings/filter/' . $format))));
   }
