Upgrade Error Stage 4/4 - cpsession - Need Help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Rushster
    Senior Member
    • Jul 2001
    • 103
    • 3.0.0 Release Candidate 3

    Upgrade Error Stage 4/4 - cpsession - Need Help

    Hi

    When we get to step 4 of the v3.03 upgrade we get this...

    Database error in vBulletin 3.0.2:
    Invalid SQL: CREATE TABLE IF NOT EXISTS cpsession (
    userid INT UNSIGNED NOT NULL DEFAULT '0',
    hash VARCHAR(32) NOT NULL DEFAULT '',
    dateline INT UNSIGNED NOT NULL DEFAULT '0',
    PRIMARY KEY (userid, hash)
    ) TYPE = HEAP
    mysql error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'hash VARCHAR(32) NOT NULL DEFAULT '',
    dateline INT UNSIGNED N
    mysql error number: 1064
    Script: http://blah.net/install/upgrade13.php?step=4

    Any ideas? We can't seem to get the boards operational again.

    Thanks for any help.
  • Steve Machol
    Former Customer Support Manager
    • Jul 2000
    • 154488

    #2
    Reupload the ungrade script and try again. Make sure you upload these in ASCII and overwrite the ones on the server.
    Steve Machol, former vBulletin Customer Support Manager (and NOT retired!)
    Change CKEditor Colors to Match Style (for 4.1.4 and above)

    Steve Machol Photography


    Mankind is the only creature smart enough to know its own history, and dumb enough to ignore it.


    Comment

    • Rushster
      Senior Member
      • Jul 2001
      • 103
      • 3.0.0 Release Candidate 3

      #3
      I assume you mean reupload 'the upgrade script'? Anway did that and tried again but same error. Everything else seems to be upgrading fine just this one stage.

      Basicly it won't create that table.

      Comment

      • Mike Sullivan
        Former vBulletin Developer
        • Apr 2000
        • 13327
        • 3.6.x

        #4
        What's your MySQL version? Looks like 'hash' is a reserved word.

        Comment

        • Rushster
          Senior Member
          • Jul 2001
          • 103
          • 3.0.0 Release Candidate 3

          #5
          MySQL version 4.0.16 If it is a reserved word is there a way round this?

          Comment

          • Mike Sullivan
            Former vBulletin Developer
            • Apr 2000
            • 13327
            • 3.6.x

            #6
            Find this line in upgrade13.php:
            Code:
            hash VARCHAR(32) NOT NULL DEFAULT '',
            Replace it with:
            Code:
            `hash` VARCHAR(32) NOT NULL DEFAULT '',
            (adds backticks around "hash")

            You'll probably have to do the same with this line:
            Code:
            PRIMARY KEY (userid, hash)
            to:
            Code:
            PRIMARY KEY (userid, `hash`)
            Does that work? The only thing I see using HASH as a keyword is MySQL 4.1.0, so I'm not sure why this is being a problem.

            Comment

            • Rushster
              Senior Member
              • Jul 2001
              • 103
              • 3.0.0 Release Candidate 3

              #7
              That seemed to have created thetabel so thanksfor that. However, logging back intot he admincp we now get...

              Database error in vBulletin 3.0.3:
              Invalid SQL: INSERT INTO cpsession (userid, hash, dateline) VALUES (8, '3fbfa797d094d689ce13c6e657f94ec9', 1098475676)
              mysql error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'hash, dateline) VALUES (8, '3fbfa797d094d689ce13c6e657f94ec9',
              mysql error number: 1064
              Date: Friday 22nd of October 2004 09:07:56 PM
              Script: http://forums.rpgforums.net/login.php
              Referer:

              I am assuming this is the same problem but where is hash referenced in the scripts? I take it every reference to hash would have to be changed to 'hash'. A list of places it appears would be handy.

              Cheers

              Comment

              • Mike Sullivan
                Former vBulletin Developer
                • Apr 2000
                • 13327
                • 3.6.x

                #8
                login.php:
                -- Line 219:
                Code:
                $DB_site->query("INSERT INTO " . TABLE_PREFIX . "cpsession (userid, hash, dateline) VALUES ($bbuserinfo[userid], '" . addslashes($cpsession) . "', " . TIMENOW . ")");
                -- Line 240:
                Code:
                $DB_site->query("INSERT INTO " . TABLE_PREFIX . "cpsession (userid, hash, dateline) VALUES ($bbuserinfo[userid], '" . addslashes($cpsession) . "', " . TIMENOW . ")");
                admincp/global.php:
                -- Line 83:
                Code:
                AND hash = '" . addslashes($_COOKIE[COOKIE_PREFIX . 'cpsession']) . "'
                -- Line 93:
                Code:
                AND hash = '" . addslashes($_COOKIE[COOKIE_PREFIX . 'cpsession']) . "'
                admincp/index.php:
                -- Line 66:
                Code:
                $DB_site->query("DELETE FROM " . TABLE_PREFIX . "cpsession WHERE userid = $bbuserinfo[userid] AND hash = '" . addslashes($_COOKIE[COOKIE_PREFIX . 'cpsession']) . "'");
                modcp/global.php:
                -- Line 59:
                Code:
                AND hash = '" . addslashes($_COOKIE[COOKIE_PREFIX . 'cpsession']) . "'
                -- Line 69:
                Code:
                AND hash = '" . addslashes($_COOKIE[COOKIE_PREFIX . 'cpsession']) . "'
                modcp/index.php:
                -- Line 50:
                Code:
                $DB_site->query("DELETE FROM " . TABLE_PREFIX . "cpsession WHERE userid = $bbuserinfo[userid] AND hash = '" . addslashes($_COOKIE[COOKIE_PREFIX . 'cpsession']) . "'");
                And remember, it needs to be `hash` , NOT 'hash' -- that'll be interpretted as something different (literally the text "hash", not a column named it).

                Comment

                • Rushster
                  Senior Member
                  • Jul 2001
                  • 103
                  • 3.0.0 Release Candidate 3

                  #9
                  Thanks that seems to have done the trick. Thanks for all the help

                  Comment

                  widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                  Working...