fencerj / sqlitepersistentobjects

sqlitepersistentobjects --- A Sqlite ORM Framework
0 stars 0 forks source link

Memory map not being filled on load #43

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I spotted an issue (or what I consider to be an issue) when loading the same 
object twice, which I 
had assumed the memory map would remember the object.

If you do something like:
Person *persona = [Person findByPK:1];
Person *personb = [Person findByPK:1];

Then persona != personb.

If you do:
Person *persona = [Person findByPK:1];
[persona save];
Person *personb = [Person findByPK:1];

Then persona == personb;

I checked through the code and I assume that it is because the memory map only 
gets filed when 
saving, not when loading. But surely we want to fill on load as well, otherwise 
it breaks the 
concept of having this memory map? No?

Original issue reported on code.google.com by mattjgal...@gmail.com on 15 Feb 2009 at 7:39

GoogleCodeExporter commented 8 years ago
Index: SQLitePersistentObject.m
===================================================================
--- SQLitePersistentObject.m    (revision 64)
+++ SQLitePersistentObject.m    (working copy)
@@ -524,6 +524,7 @@
                                }
                        }
                        [oneItem makeClean];
+                       [[self class] registerObjectInMemory:oneItem];
                        [ret addObject:oneItem];
                        [oneItem release];
                }

That seems (at first glance) to be the kind of thing that's needed in there to 
fix things.

Original comment by mattjgal...@gmail.com on 15 Feb 2009 at 10:39

GoogleCodeExporter commented 8 years ago
Thanks. Fixed in revision 67

Original comment by amle...@gmail.com on 17 Feb 2009 at 11:27

GoogleCodeExporter commented 8 years ago
Awesome - can I become a member of the project? Or are you saving that for only
specific people? I just would like to help out with it.

Original comment by mattjgal...@gmail.com on 17 Feb 2009 at 1:28

GoogleCodeExporter commented 8 years ago
I think you need to be added by project owner jeff lamarche. send him an email.

Original comment by amle...@gmail.com on 17 Feb 2009 at 8:30

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I meet this problem, too!
With the latest version, and use findByXXX twice, get only date type data but no
string type data on the second time...

Original comment by mengke.w...@gmail.com on 11 May 2009 at 2:04

GoogleCodeExporter commented 8 years ago
Now I use [SQLitePersistentObject clearCache] before I want to find something 
twice,
it works.
But may be slower a little...

Original comment by mengke.w...@gmail.com on 11 May 2009 at 2:13