? .svn ? tests/.svn ? tw_import/.svn ? tw_import/tests/.svn Index: tw.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/tw/tw.module,v retrieving revision 1.1.2.26 diff -u -w -r1.1.2.26 tw.module --- tw.module 1 May 2009 01:44:13 -0000 1.1.2.26 +++ tw.module 1 May 2009 05:31:06 -0000 @@ -37,11 +37,11 @@ // See if we're already managing this table $sql = "SELECT twtid FROM {tw_tables} - WHERE connection='%s' AND tablename='%s'"; + WHERE `connection`='%s' AND tablename='%s'"; $twtid = db_result(db_query($sql, $connection, $tablename)); if (!$twtid) { db_query("INSERT INTO {tw_tables} - (connection, tablename) + (`connection`, tablename) VALUES('%s', '%s')", $connection, $tablename); } @@ -78,7 +78,7 @@ $connection = 'default'; } $sql = "SELECT twtid FROM {tw_tables} - WHERE connection='%s' AND tablename='%s'"; + WHERE `connection`='%s' AND tablename='%s'"; $twtid = db_result(db_query($sql, $connection, $tablename)); if ($twtid) { // Remove all relationship references @@ -115,7 +115,7 @@ $connection = 'default'; } $sql = "SELECT twtid FROM {tw_tables} - WHERE connection='%s' AND tablename='%s'"; + WHERE `connection`='%s' AND tablename='%s'"; $twtid = db_result(db_query($sql, $connection, $tablename)); if ($twtid) { $sql = "UPDATE {tw_columns} @@ -191,7 +191,7 @@ $sql = "SELECT tc.twcid FROM {tw_tables} tt INNER JOIN {tw_columns} tc ON tt.twtid=tc.twtid AND tc.colname='%s' - WHERE tt.connection='%s' AND tt.tablename='%s'"; + WHERE tt.`connection`='%s' AND tt.tablename='%s'"; $twcid = db_result(db_query($sql, $colname, $connection, $tablename)); return $twcid; } @@ -205,7 +205,7 @@ */ function tw_perform_analysis($tablename, $connection = 'default') { $twtid = db_result(db_query("SELECT twtid FROM {tw_tables} - WHERE connection='%s' AND tablename='%s'", + WHERE `connection`='%s' AND tablename='%s'", $connection, $tablename)); // Let the Schema module figure out the table definition @@ -237,17 +237,17 @@ db_set_active($connection); $coltype = $coldef['type']; // Analyze the values in the table - $sql = 'SELECT MIN(' . tw_quote_column($colname) . ') FROM {' . $tablename . '}'; + $sql = 'SELECT MIN(' . tw_quote_column($colname) . ') FROM `{' . $tablename . '}`'; $minvalue = db_result(db_query($sql)); - $sql = 'SELECT MAX(' . tw_quote_column($colname) . ') FROM {' . $tablename . '}'; + $sql = 'SELECT MAX(' . tw_quote_column($colname) . ') FROM `{' . $tablename . '}`'; $maxvalue = db_result(db_query($sql)); if (tw_column_type($coltype) == 'text') { - $sql = 'SELECT MIN(CHAR_LENGTH(' . tw_quote_column($colname) . ')) FROM {' . $tablename . '}'; + $sql = 'SELECT MIN(CHAR_LENGTH(' . tw_quote_column($colname) . ')) FROM `{' . $tablename . '}`'; $minlength = db_result(db_query($sql)); if (!isset($minlength)) { $minlength = 0; } - $sql = 'SELECT MAX(CHAR_LENGTH(' . tw_quote_column($colname) . ')) FROM {' . $tablename . '}'; + $sql = 'SELECT MAX(CHAR_LENGTH(' . tw_quote_column($colname) . ')) FROM `{' . $tablename . '}`'; $maxlength = db_result(db_query($sql)); if (!isset($maxlength)) { $maxlength = 0; Index: tw.views_default.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/tw/tw.views_default.inc,v retrieving revision 1.1.2.11 diff -u -w -r1.1.2.11 tw.views_default.inc --- tw.views_default.inc 1 May 2009 01:44:13 -0000 1.1.2.11 +++ tw.views_default.inc 1 May 2009 05:31:06 -0000 @@ -15,11 +15,11 @@ // Go through each import table and create default views for them // Skip any without a primary key - $sql = "SELECT tt.twtid,tt.tablename,tt.connection,COUNT(*) cnt + $sql = "SELECT tt.twtid,tt.tablename,tt.`connection`,COUNT(*) cnt FROM {tw_tables} tt INNER JOIN {tw_columns} tc ON tt.twtid=tc.twtid WHERE tc.primarykey=1 - GROUP BY tt.twtid,tt.tablename,tt.connection"; + GROUP BY tt.twtid,tt.tablename,tt.`connection`"; $tblresult = db_query($sql); while ($tblrow = db_fetch_object($tblresult)) { // For a default view to be possible, the table must have a single primary key field Index: tw_pages.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/tw/tw_pages.inc,v retrieving revision 1.1.2.26 diff -u -w -r1.1.2.26 tw_pages.inc --- tw_pages.inc 1 May 2009 01:44:13 -0000 1.1.2.26 +++ tw_pages.inc 1 May 2009 05:31:06 -0000 @@ -29,7 +29,7 @@ '#suffix' => '', ); - $sql = "SELECT COUNT(DISTINCT(connection)) FROM {tw_tables} WHERE connection <> 'default'"; + $sql = "SELECT COUNT(DISTINCT(`connection`)) FROM {tw_tables} WHERE `connection` <> 'default'"; $extconns = db_result(db_query($sql)); if ($extconns >= 1) { $connheader = array('data' => t('Connection'), 'field' => 'twt.connection', 'sort' => 'asc'); @@ -95,7 +95,7 @@ $rowcount = t('N/A'); } else { - $sql = 'SELECT COUNT(*) FROM {' . $row->tablename . '}'; + $sql = 'SELECT COUNT(*) FROM `{' . $row->tablename . '}`'; $rowcount = db_result(db_query($sql)); } $form['rowcount'][$row->twtid] = array('#value' => $rowcount); @@ -160,7 +160,7 @@ if ($type == 'delete') { foreach ($form_state['values']['checks'] as $twtid => $value) { if ($value) { - $sql = "SELECT connection,tablename FROM {tw_tables} WHERE twtid=%d"; + $sql = "SELECT `connection`, tablename FROM {tw_tables} WHERE twtid=%d"; $row = db_fetch_object(db_query($sql, $twtid)); tw_remove_tables($row->connection . '.' . $row->tablename); drupal_set_message(t('Removed table %tablename (connection %connection)', @@ -289,7 +289,7 @@ * TODO: Flag any available FKs that are not indexed. */ function tw_analysis($form_state, $twtid, $flag=TW_COLS_NOIGNORE) { - $row = db_fetch_object(db_query("SELECT connection, tablename FROM {tw_tables} + $row = db_fetch_object(db_query("SELECT `connection`, tablename FROM {tw_tables} WHERE twtid=%d", $twtid)); $tablename = $row->tablename; @@ -661,12 +661,12 @@ ), ); - $sql = "SELECT COUNT(*) FROM {tw_tables} WHERE connection <> 'default'"; + $sql = "SELECT COUNT(*) FROM {tw_tables} WHERE `connection` <> 'default'"; $use_connection = db_result(db_query($sql)); $sql = "SELECT twr.twrid,CONCAT(twtleft.tablename, '.', twcleft.colname) leftcol, CONCAT(twtright.tablename, '.', twcright.colname) rightcol, - twtleft.connection leftconn, twtright.connection rightconn + twtleft.`connection` leftconn, twtright.`connection` rightconn FROM {tw_relationships} twr INNER JOIN {tw_columns} twcleft ON twr.leftcol=twcleft.twcid INNER JOIN {tw_tables} twtleft ON twcleft.twtid=twtleft.twtid @@ -699,11 +699,11 @@ '#title' => t('Add a relationship'), '#collapsible' => TRUE, ); - $sql = "SELECT twc.twcid, twc.colname, twt.tablename, twt.connection + $sql = "SELECT twc.twcid, twc.colname, twt.tablename, twt.`connection` FROM {tw_columns} twc INNER JOIN {tw_tables} twt ON twc.twtid=twt.twtid WHERE twc.availablefk=1 - ORDER BY connection, tablename, colname"; + ORDER BY `connection`, tablename, colname"; $result = db_query($sql); while ($row = db_fetch_array($result)) { if ($use_connection) {