diff --git a/includes/FeedsImporter.inc b/includes/FeedsImporter.inc
index f868496e07d1ad7da081a2c50bb0f48044003bec..70885762dd0f509c5ee5783ef976b2c2a546c542 100644
--- a/includes/FeedsImporter.inc
+++ b/includes/FeedsImporter.inc
@@ -99,7 +99,7 @@ class FeedsImporter extends FeedsConfigurable {
     $save = new stdClass();
     $save->id = $this->id;
     $save->config = $this->getConfig();
-    if (db_result(db_query_range("SELECT 1 FROM {feeds_importer} WHERE id = '%s'", $this->id, 0, 1))) {
+    if (db_query_range("SELECT 1 FROM {feeds_importer} WHERE id = '%s'", array(':id' => $this->id), 0, 1)->fetchField()) {
       drupal_write_record('feeds_importer', $save, 'id');
     }
     else {
diff --git a/includes/FeedsSource.inc b/includes/FeedsSource.inc
index eff59e052d946c5399baa328f22670574f976538..39014b22394883217143363c85eedef58cf9f1ba 100644
--- a/includes/FeedsSource.inc
+++ b/includes/FeedsSource.inc
@@ -242,7 +242,7 @@ class FeedsSource extends FeedsConfigurable {
       'source' => $source,
       'batch' => isset($this->batch) ? $this->batch : FALSE,
     );
-    if (db_result(db_query_range("SELECT 1 FROM {feeds_source} WHERE id = '%s' AND feed_nid = %d", $this->id, $this->feed_nid, 0, 1))) {
+    if (db_query_range("SELECT 1 FROM {feeds_source} WHERE id = :id AND feed_nid = :nid", array(':id' => $this->id, ':nid' => $this->feed_nid), 0, 1)->fetchField()) {
       drupal_write_record('feeds_source', $object, array('id', 'feed_nid'));
     }
     else {
@@ -256,7 +256,7 @@ class FeedsSource extends FeedsConfigurable {
    * @todo Patch CTools to move constants from export.inc to ctools.module.
    */
   public function load() {
-    if ($record = db_fetch_object(db_query("SELECT config, batch FROM {feeds_source} WHERE id = '%s' AND feed_nid = %d", $this->id, $this->feed_nid))) {
+    if ($record = db_query("SELECT config, batch FROM {feeds_source} WHERE id = :id AND feed_nid = :nid", array(':id' => $this->id, ':nid' => $this->feed_nid))->fetch()) {
       // While FeedsSource cannot be exported, we still use CTool's export.inc
       // export definitions.
       ctools_include('export');
diff --git a/plugins/FeedsFeedNodeProcessor.inc b/plugins/FeedsFeedNodeProcessor.inc
index 3c9b3f60b40c70e26d3e699fca184ff292bd5b5c..9429eced3ed2b625313ca15c7ae29c0bc6c2ef3d 100644
--- a/plugins/FeedsFeedNodeProcessor.inc
+++ b/plugins/FeedsFeedNodeProcessor.inc
@@ -28,7 +28,7 @@ class FeedsFeedNodeProcessor extends FeedsProcessor {
         // If updating populate nid and vid avoiding an expensive node_load().
         if (!empty($nid)) {
           $node->nid = $nid;
-          $node->vid = db_result(db_query("SELECT vid FROM {node} WHERE nid = %d", $nid));
+          $node->vid = db_query("SELECT vid FROM {node} WHERE nid = :nid", array(':nid' => $nid))->fetchField();
         }
 
         // Save the node.
@@ -202,7 +202,7 @@ class FeedsFeedNodeProcessor extends FeedsProcessor {
     // We only support one unique target: source
     foreach ($this->uniqueTargets($batch) as $target => $value) {
       if ($target == 'source') {
-        return db_result(db_query("SELECT fs.feed_nid FROM {node} n JOIN {feeds_source} fs ON n.nid = fs.feed_nid WHERE fs.id = '%s' AND fs.source = '%s'", $this->feedNodeImporter()->id, $value));
+        return db_query("SELECT fs.feed_nid FROM {node} n JOIN {feeds_source} fs ON n.nid = fs.feed_nid WHERE fs.id = :id AND fs.source = :source", array(':id' => $this->feedNodeImporter()->id, ':source' => $value))->fetchField();
       }
     }
     return 0;
diff --git a/plugins/FeedsNodeProcessor.inc b/plugins/FeedsNodeProcessor.inc
index 7cfc4813d13caa269eec10e1a0486add7fd0e1d0..7fd79479e5e0983db041814d928dea7b885eabd9 100644
--- a/plugins/FeedsNodeProcessor.inc
+++ b/plugins/FeedsNodeProcessor.inc
@@ -86,15 +86,15 @@ class FeedsNodeProcessor extends FeedsProcessor {
    */
   public function clear(FeedsBatch $batch, FeedsSource $source) {
     if (!$batch->getTotal(FEEDS_CLEARING)) {
-      $total = db_result(db_query("SELECT COUNT(nid) FROM {feeds_node_item} WHERE id = '%s' AND feed_nid = %d", $source->id, $source->feed_nid));
+      $total = db_query("SELECT COUNT(nid) FROM {feeds_node_item} WHERE id = :id AND feed_nid =:nid", array(':id' => $source->id, ':nid' => $source->feed_nid))->fetchField();
       $batch->setTotal(FEEDS_CLEARING, $total);
     }
-    $result = db_query_range("SELECT nid FROM {feeds_node_item} WHERE id = '%s' AND feed_nid = %d", $source->id, $source->feed_nid, 0, variable_get('feeds_node_batch_size', FEEDS_NODE_BATCH_SIZE));
-    while ($node = db_fetch_object($result)) {
+    $nodes = db_query_range("SELECT nid FROM {feeds_node_item} WHERE id = :id AND feed_nid =:nid", array(':id' => $source->id, ':nid' => $source->feed_nid), variable_get('feeds_node_batch_size', FEEDS_NODE_BATCH_SIZE));
+    foreach ($nodes as $node) {
       node_delete($node->nid);
       $batch->deleted++;
     }
-    if (db_result(db_query_range("SELECT nid FROM {feeds_node_item} WHERE id = '%s' AND feed_nid = %d", $source->id, $source->feed_nid, 0, 1))) {
+    if (db_query_range("SELECT 1 FROM {feeds_node_item} WHERE id = :id AND feed_nid =:nid", array(':id' => $source->id, ':nid' => $source->feed_nid), 0, 1)->fetchField()) {
       $batch->setProgress(FEEDS_CLEARING, $batch->deleted);
       return;
     }
@@ -120,11 +120,11 @@ class FeedsNodeProcessor extends FeedsProcessor {
     if ($time == FEEDS_EXPIRE_NEVER) {
       return;
     }
-    $result = db_query_range("SELECT n.nid FROM {node} n JOIN {feeds_node_item} fni ON n.nid = fni.nid WHERE fni.id = '%s' AND n.created < %d", $this->id, REQUEST_TIME - $time, 0, variable_get('feeds_node_batch_size', FEEDS_NODE_BATCH_SIZE));
-    while ($node = db_fetch_object($result)) {
+    $nodes = db_query_range("SELECT n.nid FROM {node} n JOIN {feeds_node_item} fni ON n.nid = fni.nid WHERE fni.id = :id AND n.created < :created", array(':id' => $this->id, ':created' => REQUEST_TIME - $time), 0, variable_get('feeds_node_batch_size', FEEDS_NODE_BATCH_SIZE));
+    foreach ($nodes as $node) {
       _feeds_node_delete($node->nid);
     }
-    if (db_result(db_query_range("SELECT n.nid FROM {node} n JOIN {feeds_node_item} fni ON n.nid = fni.nid WHERE fni.id = '%s' AND n.created < %d", $this->id, REQUEST_TIME - $time, 0, 1))) {
+    if (db_query_range("SELECT 1 FROM {node} n JOIN {feeds_node_item} fni ON n.nid = fni.nid WHERE fni.id = :id AND n.created < :created", array(':id' => $this->id, ':created' => REQUEST_TIME - $time), 0, 1)->fetchField()) {
       return FEEDS_BATCH_ACTIVE;
     }
     return FEEDS_BATCH_COMPLETE;
@@ -312,13 +312,13 @@ class FeedsNodeProcessor extends FeedsProcessor {
     foreach ($this->uniqueTargets($batch) as $target => $value) {
       switch ($target) {
         case 'nid':
-          $nid = db_result(db_query("SELECT nid FROM {node} WHERE nid = %d", $value));
+          $nid = db_query("SELECT nid FROM {node} WHERE nid = %d", array(':nid' => $value))->fetchField();
           break;
         case 'url':
-          $nid = db_result(db_query("SELECT nid FROM {feeds_node_item} WHERE feed_nid = %d AND id = '%s' AND url = '%s'", $source->feed_nid, $source->id, $value));
+          $nid = db_query("SELECT nid FROM {feeds_node_item} WHERE feed_nid = :nid AND id = :id AND url = :url", array(':nid' => $source->feed_nid, ':id' => $source->id, ':url' => $value))->fetchField();
           break;
         case 'guid':
-          $nid = db_result(db_query("SELECT nid FROM {feeds_node_item} WHERE feed_nid = %d AND id = '%s' AND guid = '%s'", $source->feed_nid, $source->id, $value));
+          $nid = db_query("SELECT nid FROM {feeds_node_item} WHERE feed_nid = :nid AND id = :id AND guid = :guid", array(':nid' => $source->feed_nid, ':id' => $source->id, ':guid' => $value))->fetchField();
           break;
       }
       if ($nid) {
@@ -344,7 +344,7 @@ class FeedsNodeProcessor extends FeedsProcessor {
       }
       else {
         $node->nid = $nid;
-        $node->vid = db_result(db_query("SELECT vid FROM {node} WHERE nid = %d", $nid));
+        $node->vid = db_query("SELECT vid FROM {node} WHERE nid = :nid", array(':nid' => $nid))->fetchField();
         $populate = TRUE;
       }
     }
@@ -398,8 +398,7 @@ class FeedsNodeProcessor extends FeedsProcessor {
    * @return Empty string if no item is found, hash otherwise.
    */
   protected function getHash($nid) {
-    $hash = db_result(db_query("SELECT hash FROM {feeds_node_item} WHERE nid = %d", $nid));
-    if ($hash) {
+    if ($hash = db_query("SELECT hash FROM {feeds_node_item} WHERE nid = :nid", array(':nid' => $nid))->fetchField()) {
       // Return with the hash.
       return $hash;
     }
diff --git a/plugins/FeedsTermProcessor.inc b/plugins/FeedsTermProcessor.inc
index b5b0c6d02e7ec90fefe49ae565518b44c7fc3a73..7fa48b3d648b99c4c86ef4b87bd1dcf5fa8e460d 100644
--- a/plugins/FeedsTermProcessor.inc
+++ b/plugins/FeedsTermProcessor.inc
@@ -219,7 +219,7 @@ class FeedsTermProcessor extends FeedsProcessor {
     foreach ($this->uniqueTargets($batch) as $target => $value) {
       if ($target == 'name') {
         $vocabulary = $this->vocabulary();
-        if ($tid = db_result(db_query("SELECT tid FROM {term_data} WHERE name = '%s' AND vid = %d", $value, $vocabulary->vid))) {
+        if ($tid = db_query("SELECT tid FROM {term_data} WHERE name = :name AND vid = :vid", array(':name' => $value, ':vid' => $vocabulary->vid))->fetchField()) {
           return $tid;
         }
       }
diff --git a/plugins/FeedsUserProcessor.inc b/plugins/FeedsUserProcessor.inc
index 91d2b554d3078acb9b443498ef1b0ce259eecd32..127dda95f92bb2c84f2e1222d07b6c930753de78 100644
--- a/plugins/FeedsUserProcessor.inc
+++ b/plugins/FeedsUserProcessor.inc
@@ -204,13 +204,13 @@ class FeedsUserProcessor extends FeedsProcessor {
     foreach ($this->uniqueTargets($batch) as $target => $value) {
       switch ($target) {
         case 'name':
-          $uid = db_result(db_query("SELECT uid FROM {users} WHERE name = '%s'", $value));
+          $uid = db_query("SELECT uid FROM {users} WHERE name = :name", array(':name' => $value))->fetchField();
           break;
         case 'mail':
-          $uid = db_result(db_query("SELECT uid FROM {users} WHERE mail = '%s'", $value));
+          $uid = db_query("SELECT uid FROM {users} WHERE mail = :mail", array(':mail' => $value))->fetchField();
           break;
         case 'openid':
-          $uid = db_result(db_query("SELECT uid FROM {authmap} WHERE authname = '%s' AND module = 'openid'", $value));
+          $uid = db_query("SELECT uid FROM {authmap} WHERE authname = :authname AND module = 'openid'", array(':authname' => $value))->fetchField();
           break;
       }
       if ($uid) {