I think there is a bug in the latest version as I get this error when I update my database script

user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ' 0)' at line 1 query: INSERT INTO advforum_last_post (tid, nid, cid) VALUES(1, , 0) in xxxxxxxxxxx/sites/all/modules/advanced_forum/advanced_forum.install on line 97.

The following queries were executed
advanced_forum module
Update #5002

* DELETE FROM {advforum_last_post} WHERE tid = 2
* INSERT INTO {advforum_last_post} (tid, nid, cid) VALUES(2, 122, 0)
* DELETE FROM {advforum_last_post} WHERE tid = 1
* Failed: INSERT INTO {advforum_last_post} (tid, nid, cid) VALUES(1, , 0)

So I went back to your previous version for the time.

Comments

sgdev’s picture

Title: When I updated to your last verion » Install issue with 6.x-1.0-alpha1 and 5.x-1.0-alpha9 Upgrades
Version: 6.x-1.0-alpha1 » 5.x-1.0-alpha9

I'm having the same issue in 5.x-1.0-alpha9. This is an issue with the install script.

In the CREATE TABLE for Update #5001, nid is set as nid int unsigned NOT NULL default '0'. However in the INSERT statements in Update #5002, many of the nids are set as blank / null. Do you need the nids to be blank / null or zero?

Update -- Just did a quick check by setting nid equal to "0" and manually re-inserting the failed rows into the advforum_last_post table. This doesn't seem to be the right answer since I got a user warning error message for every row. :)

user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DISTINCT(n.nid), 0 AS cid, n.created ' at line 2 query: SELECT 130 AS tid, DISTINCT(n.nid), 0 AS cid, n.created FROM node n INNER JOIN term_node tn on n.nid = tn.nid WHERE tn.tid = 130 AND n.status = 1 ORDER BY n.created DESC LIMIT 1 in /htdocs/web/includes/database.mysql.inc on line 172.
michelle’s picture

Assigned: Unassigned » michelle

Sorry, folks, it looks like somehow between testing this and committing this I lost some of my changes. No clue whatsoever how I managed to do that but the code both in cvs and on my dev site is an earlier version. Very bizarre. I can remember making the changes and testing them out and seeing that they worked and now they're not there. Anyway, I'll get this fixed up sometime today.

Michelle

michelle’s picture

Ok, I was wrong. Dealing with this first thing on waking up and getting myself confused. There is code that vanished, but that's on the .module side of things and not in the .instal. No, the .install should never be inserting blank nids. That's actually the problem... I never tested this on a site that has empty forums. Thanks for the clue, I'll get this fixed ASAP.

Michelle

michelle’s picture

Version: 5.x-1.0-alpha9 » 6.x-1.x-dev

Ok, I just ripped out everything I spent the last week working on and am trying again with using queries instead of a table. It fixes the problem but the question is how it will perform on large forums. I'll do some more testing with a larger set of generated data and see how it goes.

Committed to 5.x. Will port to 6.x if it looks like it will work.

Michelle

weimeng’s picture

Also affected by this issue, subscribing.

droshani’s picture

Just keep to the version from May 29th you will be fine, till an stable version become available.

michelle’s picture

The new alphas are perfectly usable. They just don't fill in the initial values for the last topic so they will read "n/a" until something new is posted in that forum. If you know your way around a database, just make one record for each forum tid and leave the nid/cid 0 and it should pick up on them being wrong and correct them automatically.

I don't know when there will be a new release. Still trying to work out what to do about this last topic fiasco.

Michelle

jannalexx’s picture

Title: Error on upgrade/install if site has empty forums » Install issue with 6.x-1.0-alpha1 and 5.x-1.0-alpha9 Upgrades
Version: 6.x-1.x-dev » 5.x-1.0-alpha9

same issue here 5.x-1.0-alpha9 Upgrade

advforum_last_post table error upgrading from alpha8 to alpha9
uninstalling and installing new alpha9 stops with error:

Fatal error: Call to undefined function update_sql() in ...\modules\advanced_forum\advanced_forum.install on line 106

michelle’s picture

Title: Install issue with 6.x-1.0-alpha1 and 5.x-1.0-alpha9 Upgrades » Error on upgrade/install if site has empty forums

Making title more accurate and fixing the version.

Michelle

Fayna’s picture

Title: Install issue with 6.x-1.0-alpha1 and 5.x-1.0-alpha9 Upgrades » Error on upgrade/install if site has empty forums
Version: 5.x-1.0-alpha9 » 6.x-1.x-dev

Subscribing. Works fine besides the error on installation.

michelle’s picture

Status: Active » Fixed

Committed to 6.x as well now.

Michelle

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

kirikintha’s picture

Hey guys, I changed the for each to this and the error goes away, and I cannot see any problems with the module, so maybe it works? on Line 106 or there abouts,

     // If there was a path in there, store it.
	if (is_array($theme_registry[$template]['theme paths'])) {
		$existing_path = array_shift($theme_registry[$template]['theme paths']);
	
		// Slide the paths we are adding in before the existing one.
		if ($naked_path == $current_style) {
		  // The style is already naked, so no need to add it twice.
		  array_unshift($theme_registry[$template]['theme paths'], $existing_path, $current_style);
		}
		else {
		  // Style is not naked so slip naked in as a default style.
		  array_unshift($theme_registry[$template]['theme paths'], $existing_path, $naked_path, $current_style);
		}
	
		// If there are any ancestor paths (ie: we are in a subtheme, add those)
		foreach ($ancestor_paths as $ancestor_path) {
		  $theme_registry[$template]['theme paths'][] = $ancestor_path;
		}
	
		// Put the active theme's path last since that takes precidence.
		$theme_registry[$template]['theme paths'][] = path_to_theme();
	}

Let me know if this is useless or not.