From 8137de3992e33292e9b5122b2a8a92017ad73625 Mon Sep 17 00:00:00 2001
From: Chaitanya Anil Kulkarni <chaitanyakul@cybage.com>
Date: Feb 15, 2017 7:30:05 PM

deprecated use of db_select() must replaced with \Drupal::database()->select()

diff --git a/src/Plugin/views/query/SocrataCatalogSearch.php b/src/Plugin/views/query/SocrataCatalogSearch.php
index 000111b..458204f 100644
--- a/src/Plugin/views/query/SocrataCatalogSearch.php
+++ b/src/Plugin/views/query/SocrataCatalogSearch.php
@@ -51,7 +51,7 @@
    */
   function query($get_count = FALSE) {
     // Build the query.
-    $query = db_select($this->base_table)->extend('Drupal\socrata_catalog_search\SocrataCatalogSearchSelectQuery');
+    $query = \Drupal::database()->select($this->base_table)->extend('Drupal\socrata_catalog_search\SocrataCatalogSearchSelectQuery');
     $query->addTag('socrata');
     $query->addTag('socrata_' . $this->view->storage->id());
 
diff --git a/modules/socrata/socrata_views/socrata_views.views.inc b/modules/socrata/socrata_views/socrata_views.views.inc
index bf8690a..023e736 100644
--- a/modules/socrata/socrata_views/socrata_views.views.inc
+++ b/modules/socrata/socrata_views/socrata_views.views.inc
@@ -22,7 +22,7 @@
     $components = $endpoint->getComponents();
     $dataset = $components['dataset_id'];
 
-    $query = db_select($endpoint_id)->extend('Drupal\socrata\SocrataSelectQuery');
+    $query = \Drupal::database()->select($endpoint_id)->extend('Drupal\socrata\SocrataSelectQuery');
     $query->addTag('socrata');
     //@todo: fix and add tag:
     //$query->addTag('socrata_data_' . [4x4 w/ dashes converted to underscores]);
diff --git a/modules/socrata/socrata_views/src/Plugin/views/query/Soql.php b/modules/socrata/socrata_views/src/Plugin/views/query/Soql.php
index 8c3a165..5581163 100644
--- a/modules/socrata/socrata_views/src/Plugin/views/query/Soql.php
+++ b/modules/socrata/socrata_views/src/Plugin/views/query/Soql.php
@@ -659,7 +659,7 @@
    *   Provide a countquery if this is true, otherwise provide a normal query.
    */
   public function query($get_count = FALSE) {
-    $query = db_select($this->base_table)->extend('Drupal\socrata\SocrataSelectQuery');
+    $query = \Drupal::database()->select($this->base_table)->extend('Drupal\socrata\SocrataSelectQuery');
     $query->addTag('socrata');
     $query->addTag('socrata_' . $this->view->storage->id());
 
diff --git a/modules/socrata/src/Form/EndpointForm.php b/modules/socrata/src/Form/EndpointForm.php
index 59b1747..e72dd02 100644
--- a/modules/socrata/src/Form/EndpointForm.php
+++ b/modules/socrata/src/Form/EndpointForm.php
@@ -95,7 +95,7 @@
 
     // Ensure we get a valid response from the endpoint.
     $endpoint = new Endpoint(array('url' => $url), 'endpoint');
-    $query = db_select($url)->extend('Drupal\socrata\SocrataSelectQuery');
+    $query = \Drupal::database()->select($url)->extend('Drupal\socrata\SocrataSelectQuery');
     $query->setEndpoint($endpoint);
     $query->params['$limit'] = 1;
     $resp = $query->execute();
