This Question is Resolved.

If you have a similiar issue that this thread does not address, click the button below to open a new related support topic.

 
 
Table prefix change
Posted: 15 May 2008 11:41 AM   [ Ignore ]  
Summer Student
Total Posts:  20
Joined  06-17-2006

Hi,

I’m using an exp_query in one of my templates.

{exp:query limit="10" sql="SELECT poll_id FROM exp_cu_eepoll"}
{
/exp:query}

But when i’m saving the template the code changes into

{exp:query limit="10" sql="SELECT poll_id FROM exp_cu_cu_eepoll"}
{
/exp:query}

Anyone know what’s the problem here? I’n running on EE 1.6.3

Profile
 
 
Posted: 15 May 2008 02:07 PM   [ Ignore ]   [ # 1 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  15489
Joined  05-15-2004

That is weird. Are you saving your templates as files? Can you reliably reproduce this behavior? Where does this table come from? What module is this, EEPoll? Shouldn’t the name of the table be exp_eepoll or, if you have changed the prefix, cu_eepoll?

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 16 May 2008 07:25 AM   [ Ignore ]   [ # 2 ]  
Summer Student
Total Posts:  20
Joined  06-17-2006

It’s not only the EEPoll module, even when I use the code from the wiki to count the number of entries for each category it goes wrong.

{exp:weblog:categories weblog="default_site"}
<a href="{path=weblog/index}">{category_name}</a>
{exp:query sql="SELECT count(exp_category_posts.entry_id) AS post_count
FROM exp_category_posts WHERE exp_category_posts.cat_id = {category_id} "
}
({post_count} entries)
{/exp:query}
<br />
{/exp:weblog:categories}

I’m just updating the templates in the EE installation, the template does not allow PHP and parsing stage is set to output.

Every time when I update the prefix is been multiplied

(exp_cu, exp_cu_cu, etc)

Profile
 
 
Posted: 16 May 2008 08:07 AM   [ Ignore ]   [ # 3 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  15489
Joined  05-15-2004

Are you saving your templates as files? What is the prefix you are using, anyway? Which build of EE are you using?

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 16 May 2008 08:13 AM   [ Ignore ]   [ # 4 ]  
Summer Student
Total Posts:  20
Joined  06-17-2006

I’m using build 20080319 and I’m not saving the templates as files. Tried it with filesaving but no luck. The prefix is “exp_cu”.

Profile
 
 
Posted: 16 May 2008 08:21 AM   [ Ignore ]   [ # 5 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  15489
Joined  05-15-2004

OK, I will try to replicate this behavior in my local test install. Right off the bat: I’ve had problems with using an underscore in the prefix name in the past. Let me check.

ETA: Actually, that was a dash. Nevermind.

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 16 May 2008 08:22 AM   [ Ignore ]   [ # 6 ]  
Summer Student
Total Posts:  20
Joined  06-17-2006

Thanks!

Profile
 
 
Posted: 16 May 2008 09:21 AM   [ Ignore ]   [ # 7 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  15489
Joined  05-15-2004

I can confirm this. I think it is a bug, and I will make the necessary bug report. Thanks for bringing this to our attention.

Here’s what I think is happening: Even if you use a different prefix, you can still use exp_something to access the table, EE will sort that out internally. I suspect that, upon detection that your db is using a different prefix, but you use exp in your query, it simply removes the leading “exp_” and replaces it with the “correct” prefix; which you were already using, though. So, if you’d use:

{exp:query limit="10" sql="SELECT poll_id FROM exp_eepoll"}
{
/exp:query}

EE would automatically change that to

{exp:query limit="10" sql="SELECT poll_id FROM exp_cu_eepoll"}
{
/exp:query}

which would be correct the first time around.

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 16 May 2008 09:33 AM   [ Ignore ]   [ # 8 ]  
Summer Student
Total Posts:  20
Joined  06-17-2006

Thanks for sorting that out. However when I use

{exp:query limit="10" sql="SELECT poll_id FROM exp_eepoll"}
{
/exp:query}

and just save changes, the frontend gives this error:

MySQL ERROR:

Error Number: 1146

Description
: Table 'Fstev27620.exp_cu_cu_eepoll' doesn't exist

Query: SELECT poll_id FROM exp_cu_cu_eepoll

Getting back to the template, this is the code from the template

{exp:query limit="10" sql="SELECT poll_id FROM exp_cu_eepoll"}
{
/exp:query}

So it has to be OK but it looks like EE changes the prefix again while parsing the template.

Profile
 
 
Posted: 16 May 2008 09:39 AM   [ Ignore ]   [ # 9 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  15489
Joined  05-15-2004

Yes, it certainly looks that way. I have no idea when or where the rewrite takes place, but it simply seems not to take into account that you could be using a custom prefix starting with “exp_”. I expect one of the developers to comment on that shortly.

Here’s the bug report, by the way.

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 16 May 2008 10:45 AM   [ Ignore ]   [ # 10 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  108
Joined  12-20-2005

Same problem here. When dropping the “exp_ua” from my query I get this error instead.

MySQL ERROR:

Error Number: 1146

Description
: Table 'eh7956a.members' doesn't exist

Query: SELECT screen_name FROM members WHERE member_id = '
1'

 Signature 

Phil J Leitch - Unwound Design

Profile
 
 
Posted: 18 May 2008 09:36 AM   [ Ignore ]   [ # 11 ]  
Moderator
Avatar
RankRankRankRankRankRankRank
Total Posts:  23547
Joined  05-20-2002

Thanks for the confirmation- Ingmar added the second case to the bug report.  I swear- this used to work no problem.  Is odd.

 Signature 

AKA rob1

Help Request TipsPro Network

Profile
 
 
Posted: 19 May 2008 01:36 AM   [ Ignore ]   [ # 12 ]  
Professor
Avatar
RankRankRankRankRankRankRank
Total Posts:  15489
Joined  05-15-2004

Some testing revealed another issue for me: I used prefixes to share a db between two installations of EE (the main reason to use a prefix in the first place, I think), namely the regular “exp_” and “exp_test”. When browing tables from the “exp” installation, EE would also display all the exp_test_* tables.

Now, granted, it is difficult for EE to tell whether exp_test_* is a regular table of “exp” or “exp_test”. As a quick solution, the user guide should proabbly caution users against using a custom prefix of exp_something, or it should even be enforced by EE (ie the installer?) itself.

 Signature 

Everything will be good in the end. If it’s not good, it’s not the end.

Profile
MSG
 
 
Posted: 25 June 2008 04:20 PM   [ Ignore ]   [ # 13 ]  
Administrator
Avatar
RankRankRankRankRankRankRank
Total Posts:  15869
Joined  06-03-2002

As noted in the bug tracker, this is resolved for the next release, thanks for reporting!

 Signature 
Profile
MSG
 
 
 

This Question is Resolved.

If you have a similiar issue that this thread does not address, click the button below to open a new related support topic.

 
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 65087 Total Logged-in Users: 37
Total Topics: 82226 Total Anonymous Users: 21
Total Replies: 441924 Total Guests: 209
Total Posts: 524150    
Members ( View Memberlist )