Debugging on SQL Server

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
David Dubya's picture

I'm trying to debug Quiz and get it running on SQL Server, any help would be appreciated, new to drupal module maintenance, so don't know if this is spot for such conversation...

Quiz installed ok on SQL Server.

Cannot create 1st quiz record, crashes on SAVE. Confused about the quiz_save_properties() function where it crashes on the db_query.

On 1st quiz create, quiz_node_properties table is empty, so db_query will return null (if it didn't crash). The entity_save() would then save quiz with a qnp_id of null.

How is this supposed to work for the 1st time quiz creation? Seems to be broken when you start with no data....

function quiz_save_properties($entity) {
$sql = "SELECT qnp_id FROM {quiz_node_properties}
WHERE (nid = :nid AND nid > 0 AND vid = :vid AND vid > 0)
OR (uid = :uid AND uid > 0)
OR (nid = :nid AND uid = :uid AND vid = :vid)";

$result = db_query($sql, array(':nid' => $entity->nid, ':uid' => $entity->uid, ':vid' => $entity->vid));
$entity->qnp_id = $result->fetchField();
entity_save('quiz', $entity);
}

Comments

Solved

David Dubya's picture

Ok, figured it out, SQL Server does not support using placeholders multiple times.

Quiz

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: