![]() |
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. |
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:
|
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? |
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.
|
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? |
Only if you are running multiple queries, which you can't do from the AdminCP.
|
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. |
'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.
|
Quote:
|
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.
|
Thanks for moving thread, and again I apolize for that .... rookie move, LOL.
And interesting sidenotes guys!! Learn sumptin new everyday. So Christine answered my last question and I'll remove the semicolon from future readme's, but unfortunately since I've written a public file that had one, and since I'm still learning, can I get further clarification as I could have been more specific. Can the use of a semicolon at line end of a manual query cause a problem? ..... like for people who previously ran it that way. |
Quote:
|
Quote:
|
Thanks again!!
I love definative answers!! |
All times are GMT. The time now is 05:03 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|