• Register
    • Help

    striker  0 Items
    Currently Supporting
    • Home
    • News
    • Forum
    • Wiki
    • Support
      • Manage Subscriptions
      • FAQ
      • Support For
        • VaultWiki 4.x Series
        • VaultWiki.org Site
    • What's New?
    • Buy Now
    • Manual
    • 
    • Support
    • VaultWiki 4.x Series
    • Bug
    • MySQL statement prepare error [1064]

    1. Welcome to VaultWiki.org, home of the wiki add-on for vBulletin and XenForo!

      VaultWiki allows your existing forum users to collaborate on creating and managing a site's content pages. VaultWiki is a fully-featured and fully-supported wiki solution for vBulletin and XenForo.

      The VaultWiki Team encourages you to join our community of forum administrators and check out VaultWiki for yourself.

    Issue: MySQL statement prepare error [1064]

    • Issue Tools
      • View Changes
    1. issueid=6373 April 8, 2023 1:59 PM
      Vilandra Vilandra is offline
      New Member
      MySQL statement prepare error [1064]
      Error when trying to use mass management tools

      In VW 4.1.6 with XF 2.2.12, when trying to use the mass management tool to search and replace text, I get an error when I click on "prepare and review". It tells me an unexpected error occurred and to try again later. I know this feature is in beta but I thought maybe someone would see something I don't?

      From the error log:

      Code:
      XF\Db\InvalidQueryException: MySQL statement prepare error [1064]: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'offset ASC LIMIT 50' at line 1 src/XF/Db/AbstractStatement.php:230
      Generated by: Clara Oswald Apr 8, 2023 at 1:20 PM
      
      Stack trace
      
      SELECT * FROM `xf_vw_searchresult` WHERE searchid = 1 ORDER BY offset ASC  LIMIT 50
      ------------
      
      #0 src/XF/Db/Mysqli/Statement.php(198): XF\Db\AbstractStatement->getException('MySQL statement...', 1064, '42000')
      #1 src/XF/Db/Mysqli/Statement.php(41): XF\Db\Mysqli\Statement->getException('MySQL statement...', 1064, '42000')
      #2 src/XF/Db/Mysqli/Statement.php(56): XF\Db\Mysqli\Statement->prepare()
      #3 src/XF/Db/AbstractAdapter.php(96): XF\Db\Mysqli\Statement->execute()
      #4 src/addons/vw/vw/_core/controller/db/xf2.php(170): XF\Db\AbstractAdapter->query('SELECT * FROM `...')
      #5 src/addons/vw/vw/_core/model/db/mysql/vw.php(25): vw_DB_Controller_XF2->query_read('SELECT * FROM `...')
      #6 src/addons/vw/vw/_core/controller/cp/massive/vw.php(508): vw_DB_MySQL_Model->select(Array)
      #7 src/addons/vw/vw/_core/controller/cp/massive/vw.php(455): vw_CP_Massive_Controller->get_massive_results(0, 50, true)
      #8 src/addons/vw/vw/_core/controller/cp/massive/vw.php(743): vw_CP_Massive_Controller->search()
      #9 src/addons/vw/vw/_core/controller/cp/massive/vw.php(51): vw_CP_Massive_Controller->do_search()
      #10 src/addons/vw/vw/Admin/Controller/Wiki.php(108): vw_CP_Massive_Controller->execute('dosearch', 'post')
      #11 src/addons/vw/vw/Mvc/Dispatcher.php(30): vw\vw\Admin\Controller\Wiki->_actionIndex(Object(XF\Mvc\ParameterBag))
      #12 src/addons/vw/vw/Admin/Controller/Wiki.php(51): vw\vw\Mvc\Dispatcher::dispatch(Object(vw\vw\Admin\Controller\Wiki), 'index', Object(XF\Mvc\ParameterBag))
      #13 src/XF/Mvc/Dispatcher.php(352): vw\vw\Admin\Controller\Wiki->actionIndex(Object(XF\Mvc\ParameterBag))
      #14 src/XF/Mvc/Dispatcher.php(259): XF\Mvc\Dispatcher->dispatchClass('vw\\vw\\Admin\\Con...', 'Index', Object(XF\Mvc\RouteMatch), Object(vw\vw\Admin\Controller\Wiki), NULL)
      #15 src/XF/Mvc/Dispatcher.php(115): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(vw\vw\Admin\Controller\Wiki), NULL)
      #16 src/XF/Mvc/Dispatcher.php(57): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
      #17 src/XF/App.php(2483): XF\Mvc\Dispatcher->run()
      #18 src/XF.php(524): XF\App->run()
      #19 admin.php(13): XF::runApp('XF\\Admin\\App')
      #20 {main}
      
      Request state
      
      array(4) {
        ["url"] => string(24) "/admin.php?wiki/massive/"
        ["referrer"] => string(44) "https://amalgam.zone/admin.php?wiki/massive/"
        ["_GET"] => array(1) {
          ["wiki/massive/"] => string(0) ""
        }
        ["_POST"] => array(20) {
          ["_xfToken"] => string(8) "********"
          ["panel"] => string(7) "massive"
          ["do"] => string(8) "dosearch"
          ["action"] => string(7) "replace"
          ["areachoice"] => array(1) {
            [0] => string(1) "4"
          }
          ["prefixchoice"] => array(1) {
            [0] => string(2) "-1"
          }
          ["typechoice"] => array(1) {
            [0] => string(1) "0"
          }
          ["book"] => string(0) ""
          ["category"] => string(0) ""
          ["team"] => string(0) ""
          ["replacetype"] => string(7) "replace"
          ["searchtype"] => string(3) "str"
          ["search"] => string(27) "http://www.screen-gems.net/"
          ["replace"] => string(21) "https://amalgam.zone/"
          ["searchcount"] => string(1) "0"
          ["reason"] => string(28) "mass-edit performed by admin"
          ["url"] => string(44) "https://amalgam.zone/admin.php?wiki/massive/"
          ["_xfRequestUri"] => string(24) "/admin.php?wiki/massive/"
          ["_xfWithData"] => string(1) "1"
          ["_xfResponseType"] => string(4) "json"
        }
      }
    Issue Details
    Issue Number 6373
    Issue Type Bug
    Project VaultWiki 4.x Series
    Category Admin Panel
    Status Fixed
    Priority 4 - Warnings / Script Errors
    Affected Version 4.1.6
    Fixed Version 4.1.7
    Milestone (none)
    Software DependencyXenForo 2.x
    License TypePaid
    Users able to reproduce bug 0
    Users unable to reproduce bug 0
    Attachments 0
    Assigned Users (none)
    Tags admin, bug, database, error, mysql, xenforo




    1. April 12, 2023 2:48 AM
      pegasus pegasus is offline
      VaultWiki Team
      For context, MariaDB added "offset" to its list of "reserved keywords" starting in version 5.6. This means that usage of the term must now be escaped in those newer versions.

      The following are all the unescaped uses of the term I could find inside queries.

      In src/addons/vw/vw/_core/controller/cp/massive/vw.php, find:
      Code:
      'order' => array('offset' => 'ASC')
      Replace with:
      Code:
      'order' => array(vw_DB::get()->query()->wrap('offset') => 'ASC')
      Find:
      Code:
      $query['where'][] = vw_DB::get()->query()->gt('offset', $offset, true);
      Replace with:
      Code:
      $query['where'][] = vw_DB::get()->query()->gt(vw_DB::get()->query()->wrap('offset'), $offset, true);
      In src/addons/vw/vw/_core/model/search/vw.php, find:
      Code:
      'offset' => $offset
      Replace with:
      Code:
      vw_DB::get()->query()->wrap('offset') => $offset
      Reply Reply  
    2. April 12, 2023 4:24 PM
      Vilandra Vilandra is offline
      New Member
      That worked - thank you!
      Reply Reply  
    + Reply

    Assigned Users
    Loading Please Wait
    Tags
    Loading Please Wait
    • Contact Us
    • License Agreement
    • Privacy
    • Terms
    • Top
    All times are GMT -4. The time now is 6:30 AM.
    This site uses cookies to help personalize content, to tailor your experience, and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Learn more… Accept Remind me later
  • striker
    Powered by vBulletin® Version 4.2.5 Beta 2
    Copyright © 2025 vBulletin Solutions Inc. All rights reserved.
    Search Engine Optimisation provided by DragonByte SEO (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
    Copyright © 2008 - 2024 VaultWiki Team, Cracked Egg Studios, LLC.