Results 1 to 2 of 2

Thread: Inconsistent behavior between 3.5 and 4.0

  1. #1
    Junior Member
    Join Date
    Dec 2013
    Posts
    1

    Default Inconsistent behavior between 3.5 and 4.0

    I'm new to STSdb, but I'm a already a big fan of it. I upgraded from 3.5 to 4.0 (final release version) a couple of days ago and found something unexpected.

    In short, I inserted a string key into a table, commited it, but the Exists() function returned false. The main change of my code is is to store two tables in a single file rather than 2 separated files previously. I wrote a bit of code trying to reproduce this. Would you please help to take a look if I didn't use it correctly?

    Many thanks,
    Eric

    Not working code sample:
                using (IStorageEngine engine = STSdb.FromFile("test.stsdb4"))
                {
                    ITable<string, string> table = engine.OpenXTable<string, string>("table1");
                    ITable<long, string> table2 = engine.OpenXTable<long, string>("table2");
    
    
                    for (int i = 5000000; i < 5000010; ++i)
                    {
                        string s = i.ToString();
    
    
                        table[s] = "5464507";
                        long c = table2.Count();
                        table2[i] = s;
    
    
                        engine.Commit();
    
    
                        if (!table.Exists(s))
                        {
                            Console.WriteLine("Exist " + s + " " + table.Exists(s));
                            break;
                        }
                    }
                }
    
    Working code sample: (comment out the line "long c = table2.Count()")
                using (IStorageEngine engine = STSdb.FromFile("test.stsdb4"))
                {
                    ITable<string, string> table = engine.OpenXTable<string, string>("table1");
                    ITable<long, string> table2 = engine.OpenXTable<long, string>("table2");
    
    
                    for (int i = 5000000; i < 5000010; ++i)
                    {
                        string s = i.ToString();
    
    
                        table[s] = "5464507";
                        long c = table2.Count();
                        table2[i] = s;
    
    
                        engine.Commit();
    
    
                        if (!table.Exists(s))
                        {
                            Console.WriteLine("Exist " + s + " " + table.Exists(s));
                            break;
                        }
                    }
    
    
                }
    
    Working code sample: (move the Commit() fuction call out of for loop)
                using (IStorageEngine engine = STSdb.FromFile("test.stsdb4"))
                {
                    ITable<string, string> table = engine.OpenXTable<string, string>("table1");
                    ITable<long, string> table2 = engine.OpenXTable<long, string>("table2");
    
    
                    for (int i = 5000000; i < 5000010; ++i)
                    {
                        string s = i.ToString();
    
    
                        table[s] = "5464507";
                        long c = table2.Count();
                        table2[i] = s;
    
                        if (!table.Exists(s))
                        {
                            Console.WriteLine("Exist " + s + " " + table.Exists(s));
                            break;
                        }
                    }
    
                    engine.Commit();
                 }
    

  2. #2

    Default

    Thank you for the report. We will investigate the problem in detail.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
2002 - 2014 STS Soft SC. All Rights reserved.
STSdb, Waterfall Tree and WTree are registered trademarks of STS Soft SC.