BugsBiteBugs / sqlitepersistentobjects

Automatically exported from code.google.com/p/sqlitepersistentobjects
0 stars 0 forks source link

+ [SQLitePersistentObject tableCheck] double-converting column names #20

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a SQLitePersistentObject subclass that contains an collection class 
ivar and @property 
declaration. The property name must contain in interCap.
2. Instantiate an instance of the class and save it

What is the expected output? What do you see instead?
The table generated for the ivar will be named inter__cap instead of inter_cap. 
Later code 
expects the table to be named inter_cap.

The problem seems be in the + [SQLitePersistentObject tableCheck] method. On 
line 939 of this 
method, the property name is converted to a SQL Column name. Then, when dealing 
with the 
collection classes, the property name is _again_ converted to a SQL Column 
name, on lines 979 
(Arrays), 987 (Dictionaries), and 995 (Sets).

The conversion method looks to see if a character is equal to the uppercase 
instance of the 
character. In this case, there's no difference between an uppercase and 
lowercase '_' so the 
method inserts two '_' characters - one to indicate an intercap was found and 
one representing 
the 'lowercase' variant of the underscore.

The fix for this particular bug is not to double-convert the property name in 
the table check 
method. It may be better to change the stringAsSQLColumnName method to better 
handle this 
case in the future, however.

What version of the product are you using? On what operating system?

Please provide any additional information below.

Original issue reported on code.google.com by eric.s.blair on 4 Dec 2008 at 8:57

GoogleCodeExporter commented 9 years ago
I believe this was fixed a little while ago, please confirm that latest version 
addresses.

Original comment by jeff.lam...@gmail.com on 19 Feb 2009 at 1:30