Hi,

I get the following error throught the config pages of the data module.
Fatal error: Call to undefined function db_escape_string() in C:\Users\XXXXX\Sites\acquia-drupal\sites\all\modules\data\data_search\data_search.module on line 159

Thanks for any help!

Comments

joachim’s picture

Title: Fatal error: Call to undefined function db_escape_string() in data_search.module » Port Data Search to D7
Priority: Normal » Major

Data search hasn't yet been fully ported to D7.

mikev’s picture

StatusFileSize
new52.61 KB
new49.03 KB

I am getting a bunch of issues including ajax errors (see attachment) when using views to look at or edit a data table. It is a clean drupal install on hostgator baby account. There are also mismatches in the data table schema comparison report.

arning: array_keys() [function.array-keys]: The first argument should be an array in data_search_get_fields() (line 189 of /home/.../sites/all/modules/data/data_search/data_search.module).
Warning: Invalid argument supplied for foreach() in data_search_get_fields() (line 189 of /home/.../sites/all/modules/data/data_search/data_search.module).

Fatal error: Maximum execution time of 30 seconds exceeded in /home/.../sites/all/modules/data/data.views.inc on line 153

The requested page "/admin/structure/views/view/datatable/edit?render=overlay" could not be found.

Fatal error: Call to undefined function db_escape_string() in /home/.../sites/all/modules/data/data_search/data_search.module on line 159

Fatal error: Maximum execution time of 30 seconds exceeded in /home/.../sites/all/modules/views/handlers/views_handler_field.inc on line 1033

Fatal error: Maximum execution time of 30 seconds exceeded in /home/.../includes/theme.inc on line 0

I'd be happy to try and help figure out a solution.

Mike

acouch’s picture

Status: Active » Needs review
StatusFileSize
new12.47 KB

Attached is a patch that implements the hook_search_* hooks. The only one I left out was hook_search_access. There are no special permissions created for the data module so maybe we could add that if a permission is added to the data module. This has been tested locally and passed drupal code sniffer test.

joachim’s picture

Issue summary: View changes
Status: Needs review » Needs work
+++ b/data_search/data_search.install
@@ -2,19 +2,47 @@
 function data_search_install() {
-  // Adjust length of type columns for data tables with names of a max length of 64.
-  db_query("ALTER TABLE {search_dataset} CHANGE COLUMN type type VARCHAR(64)");
-  db_query("ALTER TABLE {search_index} CHANGE COLUMN type type VARCHAR(64)");
-  db_query("ALTER TABLE {search_node_links} CHANGE COLUMN type type VARCHAR(64)");
+  // Adjust length of type columns for data tables with names of a max length of
+  // 64.
+  db_drop_primary_key('search_dataset');
+  db_change_field('search_dataset', 'type', 'type',

These changes should be declared with hook_schema_alter().

Also, I imagine that these tables are all frequently flushed and repopulated when search data is reindexed. Therefore, it would be a lot less code to just drop search module's schema and reinstall it in our hook_install(). hook_uninstall() should do the same.

joachim’s picture

Hmm it looks like #1678148: Should use db_change_field() in data_search_install function has a patch that takes care of hook_schema_alter().

acouch’s picture

Should I wait for that patch or reroll?

joachim’s picture

Actually, I can't see hook_schema_alter() in either patch on that issue. I guess the thing to do here is fold the patch over there into the patch here, then close that one as a duplicate.

joachim’s picture

Status: Needs work » Closed (won't fix)

I'm going to close this.

Search can be implemented with Search API, once #2058895: Add 'type' definition for entity properties is fixed, and this issue hasn't had any work on it in over 2 years.

I'll open an alternative issue to just retire the Data Search module.