[dev] scry sql patch
Dan Wilson
dan at acucore.com
Thu May 22 09:21:23 PDT 2003
Looks like scry isn't using standard ANSI SQL to do INSERTS. It was crapping
out with pgsql, so I went ahead and patched it. You will find it attached.
This is against a cvs update of today.
-Dan
-------------- next part --------------
Index: sql.php
===================================================================
RCS file: /repository/scry/lib/Driver/sql.php,v
retrieving revision 1.27
diff -u -r1.27 sql.php
--- sql.php 6 May 2003 06:04:14 -0000 1.27
+++ sql.php 22 May 2003 15:56:10 -0000
@@ -32,7 +32,12 @@
$wsql = sprintf(' WHERE poll_id = %s', (int)$info['poll_id']);
}
- $sql = sprintf('%s scry_polls SET poll_id = %s, poll_title = %s, poll_question = %s, poll_start = %s, poll_end = %s, poll_multiple = %s, poll_enabled = %s, poll_identifier = %s %s',
+ if ($sql == 'UPDATE') {
+ $sql_text = '%s scry_polls SET poll_id = %s, poll_title = %s, poll_question = %s, poll_start = %s, poll_end = %s, poll_multiple = %s, poll_enabled = %s, poll_identifier = %s %s';
+ } else {
+ $sql_text = '%s scry_polls (poll_id, poll_title, poll_question, poll_start, poll_end, poll_multiple, poll_enabled, poll_identifier) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)';
+ }
+ $sql = sprintf($sql_text,
$sql,
$info['poll_id'],
$this->_db->quote($info['poll_title']),
@@ -234,7 +239,7 @@
foreach ($vote['choice'] as $choice) {
$vote_id = $this->_db->nextId('scry_votes');
- $sql = sprintf('INSERT INTO scry_votes SET vote_id = %s, poll_id = %s, choice_id = %s, vote_ip = %s, vote_username = %s, vote_identifier = %s, vote_confirmation = %s, vote_timestamp = %s',
+ $sql = sprintf('INSERT INTO scry_votes (vote_id, poll_id, choice_id, vote_ip, vote_username, vote_identifier, vote_confirmation, vote_timestamp) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)',
(int)$vote_id,
(int)$vote['poll_id'],
(int)$choice,
More information about the dev
mailing list