This must be a sqlite problem. Web2py has no logic in this regard.

On Thursday, 14 June 2012 00:24:22 UTC-5, sesenmaister wrote:
>
> I'm using SQLDB('sqlite://mydb.db').
>
> I was extracting info from a table using regular expressions, and 
> inserting and updating the info in a new table. I had truncate()d a lot of 
> times the table which later had the problem. 
>
>
> On Thursday, June 14, 2012 5:53:34 AM UTC+2, Massimo Di Pierro wrote:
>>
>>
>> db.table.truncate just runs the sql "TRUNCATE TABLE table". There is 
>> basically no web2py logic outside the SQL. Which database are you using? Is 
>> there an event that triggered the change in behavior?
>>
>>
>> On Wednesday, 13 June 2012 21:16:12 UTC-5, sesenmaister wrote:
>>>
>>> Some evil happended, and truncate() has stopped working properly in 
>>> editor: doesn't reset the counter id, as did before, but only for one of my 
>>> tables.
>>>
>>> def cleaning_db():
>>>>     db.table1.truncate()
>>>>     db.table2.truncate()
>>>>
>>>> def myAction(): 
>>>>      cleaning_db()
>>>>      db.table1.insert(car='chev')
>>>>      db.table2.insert(car='chev')
>>>>      return 
>>>> len(db().select(db.table1.ALL)==len(db().select(db.table2.ALL)
>>>>
>>>
>>>
>>> myAction returns False
>>>
>>> Counter id is at position 1 for table2. For table1 is at position 3892 
>>> (and counting...)
>>>
>>> Using db.table1.drop() for once, database works fine again.
>>>
>>> But I was programming from editor in localhost, filling tables using the 
>>> insert and update methods, nothing complex. So I'm very surprised. How can 
>>> I prevent this to happen again?
>>>
>>

Reply via email to