The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Adding TABLE_PREFIX in a manual query
I don't know if it's a vbulletin bug or maybe me telling people to do something that's incorrect and I seek advise here as I don't wish to report it as a bug until someone with more knowledge tells me they think the same.
In my "whodownloaded this attachment" hack.... https://vborg.vbsupport.ru/showthread.php?t=91390 .... I require adding one new field to vb's existing "user" table. Post#13 shows C.Birch with a 1064 error when running my query. Quote:
1) Is this a vbulletin bug and it's adding a space when it shouldn't? 2) Is the query I ask people to run incorrect? Why am I now thinking that the " marks should be ' Hmmm HELP? For now I asked my installers to manually edit the query with their prefix if they use one but I'd rather not leave it like that if possible. Crap, I'm sorry I asked a question in here. I didn't mean that. Can someone move this please? (or answer it and it will then be a "how-to", LOL) Again, I am truely sorry. |
#2
|
||||
|
||||
Quote:
PHP Code:
I would tell the users to do the manual query PHP Code:
To explain better with your query, if the user who is running the query has a table prefix of "vb3_", then the query should be PHP Code:
PHP Code:
|
#3
|
|||
|
|||
Your fix is basically what I told my other thread (meaning I concurr with you about solution).
But if they run the query from WITHIN the admincp, wouldn't globals be loaded? I suppose it's possible he ran it from phpmyadmin, but why would he have? |
#4
|
||||
|
||||
It won't work from within the admincp either, the query is just passed straight to mysql (as is) - mysql will trip over the table prefix just the same.
|
#5
|
|||
|
|||
Thanks guys!!
On a related note, I notice Cloudrunner has no semicolon at the end. Should there be a semicolon at end of query? Or not? Or does it not matter either way? |
#6
|
||||
|
||||
Only if you are running multiple queries, which you can't do from the AdminCP.
|
#7
|
|||
|
|||
Since when do you add columns by ADD COLUMN? When you add columns in phpmyadmin, it will show the column addition as just "ADD" without any "COLUMN" afterwards.
EDIT: This tutorial confirms what I just said. So you might wanna replace ADD COLUMN with ADD. |
#8
|
|||
|
|||
'ADD COLUMN' is the official syntax. You can however leave the 'COLUMN' out. Just the 'ADD' will be enough for MySQL to understand what you want.
|
#9
|
|||
|
|||
Quote:
|
#10
|
|||
|
|||
If you want to be compatible with every system/configuration, you should stick to ANSI SQL, and use ADD COLUMN. There are no garantuees that i would work in future versions, and if vB would sometime support other database system (Oracle for example), you would be in more problems with only a ADD.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|