|
|
Joined: Aug 2006
Posts: 1,360 Likes: 2
Veteran
|
|
Veteran
Joined: Aug 2006
Posts: 1,360 Likes: 2 |
Control panel > database tools > info /admin/dbinfo.php
SHOW TABLE STATUS LIKE '{$config['TABLE_PREFIX']}%'
This query does not escape special characters, like the underscore. I have both an ubbtest_ and ubbt_, and if I do a database info on the ubbt_ setup, I also get all ubbtest_ tables. Escaping the underscore with an \ would do the trick. Not really a biggy I guess 
|
|
|
|
|
Joined: Jun 2006
Posts: 9,242 Likes: 1
Former Developer
|
|
Former Developer
Joined: Jun 2006
Posts: 9,242 Likes: 1 |
Thanks for the info. Already have 7.2.2 packaged up, but I'll make a note on this to get it fixed for the next release.
|
|
|
|
|
Joined: Aug 2006
Posts: 1,360 Likes: 2
Veteran
|
|
Veteran
Joined: Aug 2006
Posts: 1,360 Likes: 2 |
Already have 7.2.2 packaged up, In case your waiting for my permission, it's ok to but in the members area 
|
|
|
|
|
Joined: Apr 2007
Posts: 3,940 Likes: 1
Former Developer
|
|
Former Developer
Joined: Apr 2007
Posts: 3,940 Likes: 1 |
using LIKE is not the way to go either, because there is no guarantee of _ after each prefix... yes, i always DO use _, but it's not forced upon the admin at setup.. assume there are two db's 'ubbt' and 'ubbtest' (no underscore).. the like will match both too if the query did "like ubbt%" best way is to do an equality check on the actual prefix including the length.. ie: SHOW TABLE STATUS WHERE LEFT(Name,LENGTH('{$config['TABLE_PREFIX']}')) = '{$config['TABLE_PREFIX']}'this should also handle the _ problem you had.. assumes latin1 charset (you may have different)  2c
|
|
|
|
|
Joined: Aug 2006
Posts: 1,360 Likes: 2
Veteran
|
|
Veteran
Joined: Aug 2006
Posts: 1,360 Likes: 2 |
using LIKE is not the way to go either, because there is no guarantee of _ after each prefix... yes, i always DO use _, but it's not forced upon the admin at setup.. I know it's not guaranteed. But doesn't escaping the _ with a \ make sure you test for ubbt_ instead of ubbt?. Don't see why like can't do the trick we want. this should also handle the _ problem you had..  well, it definatly saves adding code to escape the _.
|
|
|
|
|
Joined: Apr 2007
Posts: 3,940 Likes: 1
Former Developer
|
|
Former Developer
Joined: Apr 2007
Posts: 3,940 Likes: 1 |
sure it will, if we assume _ is forced.. i will cede that point. now some poor bastard is gonna leave an _ out and he won't get what he expects.. it only affects that one line, so i was suggesting how to handle all cases.. i would be interested if that query handles the _ for you though.. without escaping the _ .. because i have the exact same setup .. (ubbt_ and ubbtmuhaha_) and it works ... so all i can see is that we have two diff charsets for the db? or diff version of mysql ? (i have latin1, mysql5) and DON'T have to escape the _ .. hehe postscript.. a user can still screw themselves if the WANT.. but i wouldn't worry too much about it either.. ie: ubbt_ and ubbt_new_  so we are splitting hairs to an extent, but i like to go 'geek' every so often 
|
|
|
|
|
Joined: Aug 2006
Posts: 1,360 Likes: 2
Veteran
|
|
Veteran
Joined: Aug 2006
Posts: 1,360 Likes: 2 |
sure it will, if we assume _ is forced.. i will cede that point. Don't need to asume that. Just a need to escape the _ in the prefix, if it's used. And the % is someone is smart enough to use that. Gonna test the alternative query now. Edit: Your alternatives is A okay here also.
Last edited by blaaskaak; 08/27/2007 4:35 PM. Reason: I tested something, whoohoo!
|
|
|
|
|
Joined: Apr 2007
Posts: 3,940 Likes: 1
Former Developer
|
|
Former Developer
Joined: Apr 2007
Posts: 3,940 Likes: 1 |
thanks blaask for trying that. the reason i was wondering is because we use _ everywhere and i don't see why it makes a diff in THIS case.. only thing (and i'd have to look it up) is that 'LIKE' somehow doesn't care about them? dunno 
|
|
|
|
|
Joined: Apr 2007
Posts: 3,940 Likes: 1
Former Developer
|
|
Former Developer
Joined: Apr 2007
Posts: 3,940 Likes: 1 |
lol i just read your reply...
i guess _ and LIKE are causing it.. i'll check mysql manual on that..
mssql doesn't care, i know..
|
|
|
|
|
Joined: Aug 2006
Posts: 1,360 Likes: 2
Veteran
|
|
Veteran
Joined: Aug 2006
Posts: 1,360 Likes: 2 |
i guess _ and LIKE are causing it.. i'll check mysql manual on that.. Don't need to guess, the _ is causing it. In like, the % is like the * and the _ is like the ?. Hmm, this made more sense typing it then reading it back 
|
|
|
|
|
Joined: Apr 2007
Posts: 3,940 Likes: 1
Former Developer
|
|
Former Developer
Joined: Apr 2007
Posts: 3,940 Likes: 1 |
aha! that is the single character wildcard  whoops.. you beat me to the punch again.. oh, well now we know the WHY and the HOW TO fix anyway...  cheers..
|
|
|
|
|
Joined: Aug 2006
Posts: 1,360 Likes: 2
Veteran
|
|
Veteran
Joined: Aug 2006
Posts: 1,360 Likes: 2 |
In like, the % is like the * and the _ is like the ?. that is the single character wildcard  I think there are countries where you would be locked away for saying any of these 2 things 
|
|
|
|
|
Joined: Apr 2007
Posts: 3,940 Likes: 1
Former Developer
|
|
Former Developer
Joined: Apr 2007
Posts: 3,940 Likes: 1 |
Yarp's implementation is now in 7.3
|
|
|
|
1 members (1 invisible),
304
guests, and
96
robots. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
|