Friday, November 21, 2014

cache_field Errors in Drupal Websites

While building an E-Commerce website, I've encountered the following error


" PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'mydatabasename.cache_field' doesn't exist: DELETE FROM {cache_field} WHERE (cid LIKE :db_condition_placeholder_0 ESCAPE '\\') ; Array ( [:db_condition_placeholder_0] => field\_info\_types:% ) in cache_clear_all() (line 167 of C:\Users\globalsoftbay\Sites\devdesktop\mywebsitename\includes\cache.inc). "


Let's see how to solve this.

The above error occurs genrally when the cache_field table/view is corrupt.



The easier way is to truncate the table without dtopping so that we don't need to create it again. But when I went to my phpmyadmin and clicked on this view, I received the following error.

" #1146 - Table 'mydatabasename.cache_field' doesn't exist "


So, now the solution is to drop it and create using same structure.

Execute the following SQL code and get it done. :)

  1. drop TABLE `cache_field`;
  2. CREATE TABLE IF NOT EXISTS `cache_field` (
        `cid` varchar(255) NOT NULL DEFAULT '' COMMENT 'Primary Key: Unique cache ID.',
        `data` longblob COMMENT 'A collection of data to cache.',
        `expire` int(11) NOT NULL DEFAULT '0' COMMENT 'A Unix timestamp indicating when the cache entry should expire, or 0 for never.',
        `created` int(11) NOT NULL DEFAULT '0' COMMENT 'A Unix timestamp indicating when the cache entry was created.',
        `serialized` smallint(6) NOT NULL DEFAULT '0' COMMENT 'A flag to indicate whether content is serialized (1) or not (0).',
        PRIMARY KEY (`cid`),
        KEY `expire` (`expire`)
        )
        ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Generic cache table for caching things not separated out...';
Refresh the page with error. If the error is gone, fine :) But my case is complex. I received one more error. Below is the same

" PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'mydatabasename.cache_rules' doesn't exist: TRUNCATE {cache_rules} ; Array ( ) in cache_clear_all() (line 167 of C:\Users\globalsoftbay\Sites\devdesktop\mywebsitename\includes\cache.inc). "

For fixing this, I followed this procedure.



If you enjoyed this post, make sure you subscribe to my RSS feed! Comments are encouraged

No comments:
Write comments