All Activity

This stream auto-updates   

  1. Last week
  2. Earlier
  3. yes this does the trick, iterator.remove thanks
  4. PerstCode.txt
  5. 1. You should exclude objects from index(es) prior to deallocation it. I do not think that it will really cause a problem in your case, but in any case it is reasonable to exclude objects from indexes before deallocating them. 2. Deallocation of objects is done in many Perst examples. You can look at TestAlloc.java, for example. 3. It is not clear from your code what is the original size of the database and how many objects are actually deleted by deleteFahrt. If it deletes just a few objects that have a total size of less than one page, then the size of database after compactification could be the same as the original database.
  6. Hello, I changed my code and add deallocate for each object. But after that the used storage size is the same like before. I will attach my new Code to this post. Can you write me some example code how to completly delete single objects(with deallocation and so on)? Perst delete Fahrt.txt
  7. Excluding objects from index doesn't cause deallocation of object instances themselves. You must explicitly call Deallocate() method for each object or use ITable.DeallocateMembers method.
  8. Hello, I changed my code for delete and added a db.commit. But this changes nothing. The needed Space is the same like before delete. I will attach my new code to this post. Perst delete code example.txt
  9. You need to commit the current transaction to persist your changes and make them visible in backup.
  10. yes. This happens in line 27 - 30 of my code Perst delete Fahrt.txt.
  11. After the backup, did you delete the original database file and rename the backup to the name of the original file?
  12. Inside this code I delete the data and made a backup. You said after delete all data and making a backup the internal storage gets free. But this is not working. After delete and backup the size needed from internal storage is the same size like before delete.
  13. Yes, of course.
  14. What are we looking for in your code?
  15. I will attach the used code as file to this post. Perst delete Fahrt.txt
  16. This worked great, thanks for the quick response! Will this be added to the latest Perst source code for the general public?
  17. No, you should perform backup to some other file and then you can rename it to original file.
  18. Can I use the same filepath which I use for the database or do I have to use a second file for backup?
  19. It is Storage.backup method: /** * Backup current state of database * @param out output stream to which backup is done */ public void backup(java.io.OutputStream out) throws java.io.IOException; /** * Backup current state of database to the file with specified path * @param filePath path to the backup file * @param cipherKey cipher key for the encryption oof the backup file, null to disable encryption */ public void backup(String filePath, String cipherKey) throws java.io.IOException; It performs backup of the storage file and defragment it at the same time.
  20. Apply the following patch to database.cs, rebuild Perst, and it should fix the problem: Index: src/Database.cs =================================================================== --- src/Database.cs (revision 15853) +++ src/Database.cs (working copy) @@ -1827,23 +1827,23 @@ } if (expr.NodeType == ExpressionType.OrElse) { - if (left.NodeType == ExpressionType.Equal && IsLiteral(((BinaryExpression)left).Right, out value)) + if (right.NodeType == ExpressionType.Equal && IsLiteral(((BinaryExpression)right).Right, out value)) { - Expression baseExpr = ((BinaryExpression)left).Left; + Expression baseExpr = ((BinaryExpression)right).Left; alternatives = new ArrayList(); - while (right is BinaryExpression) + while (left is BinaryExpression) { Expression cmp; - if (right.NodeType == ExpressionType.OrElse) + if (left.NodeType == ExpressionType.OrElse) { - BinaryExpression or = (BinaryExpression)right; - right = or.Right; - cmp = or.Left; + BinaryExpression or = (BinaryExpression)left; + left = or.Left; + cmp = or.Right; } else { - cmp = right; - right = null; + cmp = left; + left = null; } if (cmp.NodeType != ExpressionType.Equal || !EqualExpressions(baseExpr, ((BinaryExpression)cmp).Left) @@ -1853,11 +1853,11 @@ } alternatives.Add(value); } - if (right != null) + if (left != null) { return null; } - expr = left; + expr = right; left = ((BinaryExpression)expr).Left; right = ((BinaryExpression)expr).Right; }
  21. I've constructed a Perst database that contains several gigs worth of data, all keyed off of date. Occasionally, I have the need to query data across multiple, non-sequential dates using LINQ. Is it currently possible to do this in a way in which the index isn't ignored? So far, I've attempted the following: - Using multiple OR statements - PerstDBTable.Where(a => a.date == date1 || a.date == date2 || a.date == date3); //this only works up to two dates, with 3+ dates the index is ignored and a sequential scan is used. - Using a list and Contains - List<DateTime> dates = new List<DateTime>(); //populate dates here PerstDBTable.Where(a => dates.contains(a.Date)); //This query throws an exception within Perst Please let me know your thoughts. Thank you in advance!
  22. Where can I find this Method? I cannot find it with my rootclass or my index. How can I call the compactify method.
  23. Perst never shrinks the size of a database. It just marks deallocated objects as free. This space will be reused by new allocation requests. This space is not returned to the file system, so you will not see extra free space after the end of a bulk delete. You can use the compactify method to shrink the database.
  24. Do you have any ideas how to solve this problem? Regards Mikkel
  25. Hello, I write some code to delete the data I added before. But it looks like it doesn't work. If I delete all data, and then make a reset and close the app I can see in the settings of my phone that the app still uses 4,5gb of diskspace for data. I will attach a .txt file with my code used for delete and reset Regards Mikkel Perst delete code example.txt
  26. Hy, yes. It is solved. Thank you very much
  27. Mikkel, is this case resolved?
  1. Load more activity