Database query failed

Help
2013-03-08
2013-05-30
  • Noel Casimiro
    Noel Casimiro
    2013-03-08

    Hi. I have encountered this bug after clicking the Call Number sort tab in the reports area. I hope someone can help me on this.

    Database Query Error - You've Probably Found a Bug

    Database query failed

    Please give all the information on this page to your support personnel.

    Query select b.bibid, concat_ws(' ', b.call_nmbr1, b.call_nmbr2, b.call_nmbr3) callno, c.barcode_nmbr, c.create_dt, b.title, b.author, coll.description as collection, mat.description as material from biblio_copy c, biblio b, collection_dm as coll, material_type_dm as mat where b.bibid=c.bibid and mat.code=b.material_cd and coll.code=b.collection_cd and c.create_dt >= '2013-03-07' and b.material_cd = '2' group by c.barcode_nmbr, b.title, b.author order by if(callno regexp '^ *', concat('0', ifnull(floor(log10(callno)), 0), callno), callno) failed. The DBMS said this:

    Unknown column 'callno' in 'order clause'
    Debug Backtrace (most recent call first):

    C:\Program Files\xampp\htdocs\openbiblio\classes\Error.php:137 FatalHandler->printBackTrace()
    C:\Program Files\xampp\htdocs\openbiblio\classes\Error.php:105 FatalHandler->dbError('select b.bibid, concat_ws(\' \', b.call_nmbr1, b.call_nmbr2, b.call_nmbr3) callno, c.barcode_nmbr, c.create_dt, b.title, b.author, coll.description as collection, mat.description as material from biblio_copy c, biblio b, collection_dm as coll, material_type_dm as mat where b.bibid=c.bibid and mat.code=b.material_cd and coll.code=b.collection_cd and c.create_dt >= \'2013-03-07\' and b.material_cd = \'2\' group by c.barcode_nmbr, b.title, b.author order by if(callno regexp \'^ *\', concat(\'0\', ifnull(floor(log10(callno)), 0), callno), callno)  ', 'Database query failed', 'Unknown column \'callno\' in \'order clause\'')
    C:\Program Files\xampp\htdocs\openbiblio\classes\Query.php:91 Fatal->dbError('select b.bibid, concat_ws(\' \', b.call_nmbr1, b.call_nmbr2, b.call_nmbr3) callno, c.barcode_nmbr, c.create_dt, b.title, b.author, coll.description as collection, mat.description as material from biblio_copy c, biblio b, collection_dm as coll, material_type_dm as mat where b.bibid=c.bibid and mat.code=b.material_cd and coll.code=b.collection_cd and c.create_dt >= \'2013-03-07\' and b.material_cd = \'2\' group by c.barcode_nmbr, b.title, b.author order by if(callno regexp \'^ *\', concat(\'0\', ifnull(floor(log10(callno)), 0), callno), callno)  ', 'Database query failed', 'Unknown column \'callno\' in \'order clause\'')
    C:\Program Files\xampp\htdocs\openbiblio\classes\Query.php:59 Query->_act('select b.bibid, concat_ws(\' \', b.call_nmbr1, b.call_nmbr2, b.call_nmbr3) callno, c.barcode_nmbr, c.create_dt, b.title, b.author, coll.description as collection, mat.description as material from biblio_copy c, biblio b, collection_dm as coll, material_type_dm as mat where b.bibid=c.bibid and mat.code=b.material_cd and coll.code=b.collection_cd and c.create_dt >= \'2013-03-07\' and b.material_cd = \'2\' group by c.barcode_nmbr, b.title, b.author order by if(callno regexp \'^ *\', concat(\'0\', ifnull(floor(log10(callno)), 0), callno), callno)  ')
    C:\Program Files\xampp\htdocs\openbiblio\classes\Rpt.php:704 Query->select('select b.bibid, concat_ws(\' \', b.call_nmbr1, b.call_nmbr2, b.call_nmbr3) callno, c.barcode_nmbr, c.create_dt, b.title, b.author, coll.description as collection, mat.description as material from biblio_copy c, biblio b, collection_dm as coll, material_type_dm as mat where b.bibid=c.bibid and mat.code=b.material_cd and coll.code=b.collection_cd and c.create_dt >= \'2013-03-07\' and b.material_cd = \'2\' group by c.barcode_nmbr, b.title, b.author order by if(callno regexp \'^ *\', concat(\'0\', ifnull(floor(log10(callno)), 0), callno), callno)  ')
    C:\Program Files\xampp\htdocs\openbiblio\classes\Rpt.php:66 RptIter->RptIter(array (
      0 =>
      array (
        0 =>
        array (
          0 =>
          array (
            0 => 'sqlcode',
            1 => 'select b.bibid, concat_ws(\' \', b.call_nmbr1, b.call_nmbr2, b.call_nmbr3) callno, ',
          ),
          1 =>
          array (
            0 => 'sqlcode',
            1 => 'c.barcode_nmbr, c.create_dt, b.title, b.author, ',
          ),
          2 =>
          array (
            0 => 'sqlcode',
            1 => 'coll.description as collection, mat.description as material ',
          ),
          3 =>
          array (
            0 => 'sqlcode',
            1 => 'from biblio_copy c, biblio b, ',
          ),
          4 =>
          array (
            0 => 'sqlcode',
            1 => 'collection_dm as coll, material_type_dm as mat ',
          ),
          5 =>
          array (
            0 => 'sqlcode',
            1 => 'where b.bibid=c.bibid ',
          ),
          6 =>
          array (
            0 => 'sqlcode',
            1 => 'and mat.code=b.material_cd ',
          ),
          7 =>
          array (
            0 => 'sqlcode',
            1 => 'and coll.code=b.collection_cd ',
          ),
          8 =>
          array (
            0 => 'if_set',
            1 => 'newer',
            2 =>
            array (
              0 =>
              array (
                0 => 'sqlcode',
                1 => 'and c.create_dt >= ',
              ),
              1 =>
              array (
                0 => 'value',
                1 => 'newer',
                2 => '%Q',
              ),
              2 =>
              array (
                0 => 'sqlcode',
                1 => ' ',
              ),
            ),
            3 =>
            array (
            ),
          ),
          9 =>
          array (
            0 => 'if_set',
            1 => 'older',
            2 =>
            array (
              0 =>
              array (
                0 => 'sqlcode',
                1 => 'and c.create_dt < ',
              ),
              1 =>
              array (
                0 => 'value',
                1 => 'older',
                2 => '%Q',
              ),
              2 =>
              array (
                0 => 'sqlcode',
                1 => ' ',
              ),
            ),
            3 =>
            array (
            ),
          ),
          10 =>
          array (
            0 => 'if_not_equal',
            1 => 'collection',
            2 => '',
            3 =>
            array (
              0 =>
              array (
                0 => 'sqlcode',
                1 => 'and b.collection_cd = ',
              ),
              1 =>
              array (
                0 => 'value',
                1 => 'collection',
                2 => '%Q',
              ),
              2 =>
              array (
                0 => 'sqlcode',
                1 => ' ',
              ),
            ),
            4 =>
            array (
            ),
          ),
          11 =>
          array (
            0 => 'if_not_equal',
            1 => 'material',
            2 => '',
            3 =>
            array (
              0 =>
              array (
                0 => 'sqlcode',
                1 => 'and b.material_cd = ',
              ),
              1 =>
              array (
                0 => 'value',
                1 => 'material',
                2 => '%Q',
              ),
              2 =>
              array (
                0 => 'sqlcode',
                1 => ' ',
              ),
            ),
            4 =>
            array (
            ),
          ),
          12 =>
          array (
            0 => 'sqlcode',
            1 => 'group by c.barcode_nmbr, b.title, b.author ',
          ),
          13 =>
          array (
            0 => 'order_by_expr',
          ),
        ),
        1 =>
        array (
        ),
      ),
    ), Params::__set_state(array(
       'dict' =>
      array (
        'newer' =>
        array (
          0 => 'string',
          1 => '2013-03-07',
        ),
        'older' => '',
        'collection' =>
        array (
          0 => 'string',
          1 => '',
        ),
        'material' =>
        array (
          0 => 'string',
          1 => '2',
        ),
        'order_by' =>
        array (
          0 => 'order_by',
          1 => 'if(callno regexp \'^ *\', concat(\'0\', ifnull(floor(log10(callno)), 0), callno), callno) ',
          2 => 'callno',
        ),
      ),
    )))
    C:\Program Files\xampp\htdocs\openbiblio\classes\Report.php:177 Rpt->select(Params::__set_state(array(
       'dict' =>
      array (
        'newer' =>
        array (
          0 => 'string',
          1 => '2013-03-07',
        ),
        'older' => '',
        'collection' =>
        array (
          0 => 'string',
          1 => '',
        ),
        'material' =>
        array (
          0 => 'string',
          1 => '2',
        ),
        'order_by' =>
        array (
          0 => 'order_by',
          1 => 'if(callno regexp \'^ *\', concat(\'0\', ifnull(floor(log10(callno)), 0), callno), callno) ',
          2 => 'callno',
        ),
      ),
    )))
    C:\Program Files\xampp\htdocs\openbiblio\classes\Report.php:182 Report->_getIter()
    C:\Program Files\xampp\htdocs\openbiblio\reports\run_report.php:143 Report->count()

     
  • A quick answer, can't test it myself right now.

    The copies report that comes with OpenBiblio can't sort on call number. You are using an extend version of this report, that is published on the wiki.
    http://obiblio.sourceforge.net/index.php/Reports/CopySearch

    after clicking the Call Number sort tab

    Did you mean clicking the up and down arrows in the table header?

    The report criteria also offers sorting options, and these can be different from the sorting options in the table header. Perhaps you can use this to avoid the error.

     
  • Noel Casimiro
    Noel Casimiro
    2013-03-09

    Did you mean clicking the up and down arrows in the table header?

    Hi. Thanks for the quick reply. Yes, I mean clicking the up and down arrows in the reports results area. Here are the screenshots:

     
  • Noel Casimiro
    Noel Casimiro
    2013-03-09

    My apologies, the screenshots links are broken. I can sort the report results by title, author, barcode, acq date, collection, and material but not by call number. I also tried breaking the call number into 3 parts as suggested in the link you provided, but still sorting by call number doesn't work.

     
  • Ah, if there is column Acq. Date then you are NOT using the extended version of Copy Search, it must be the Acquisition report that comes with OpenBiblio.
    I wonder if the results are OK for the extended Copy Search report, following the instructions for adding reports to OpenBiblio.

    By the way: what is the version of MySQL and / or xampp?

     


Anonymous


Cancel   Add attachments