Forum OpenACS Q&A: Re: undefined variable clob_answer

Collapse
Posted by bill kellerman on
looks like i solved the problem myself.  yay!

in /web/oacs/packages/acs-tcl/tcl/00-database-procs-postgresql.tcl, checking the comments within proc_doc db_dbml { ... } :

...
db_with_handle db {
            # another ugly hack to avoid munging tcl files.
            # __lob_id needs to be set inside of a query (.xql) file for this
            # to work.  Say for example that you need to create a lob. In
            # Oracle, you would do something like:

            # db_dml update_photo  "update foo set bar = empty_blob()
            #                      where bar = :bar
            #                      returning foo into :1" -blob_files [list $file]
            # for postgresql we can do the equivalent by placing the following
            # in a query file:
            # update foo set bar = [set __lob_id [db_string get_id "select empty_lob()"]]
            # where bar = :bar
...

so then i found /web/oacs/packages/simple-survey/process-request-postgresql.xql and changed the following empty_lob() value to [set __lob_id [db_string get_id "select empty_lob()"]]:

<fullquery name="survsimp_question_response_text_insert">
      <querytext>

      insert into survsimp_question_responses
      (response_id, question_id, clob_answer)
      values
      (:response_id, :question_id, [set __lob_id [db_string get_id "select empty_lob()"]])

      </querytext>
</fullquery>

Answers now seem to be submitting properly.  Is the db_dml suggestion the best fix?  I've used simple-survey in the past with no problems.  I am using a newer version of postgresql, but it seems more an issue of the tcl laying around the procs.  If that is the case, shouldn't others be having the same problem?  And could this be a permanent fix if justified?