On Fri, Jul 22, 2011 at 03:37:34PM +0200, Sintoni Stefano (GMAIL) scratched on 
the wall:
> More thanks,
> I understand that but why the same query, with the same data, return two
> different result using different SQLite-based Win32 applications ?

  My best guess is that they're using different versions or slightly
  different builds of the SQLite core library.  Changes and improvements
  in the query optimizer can result in different orderings.

  Regardless, you should never trust the order of a SELECT that lacks
  an ORDER BY, even for the same version of the same code on the same
  database.  Adding or removing an index, running ANALYZE, or many other
  things can alter the order of results.  SQLite even has a PRAGMA to
  test for unintentional order dependencies (reverse_unordered_selects).

> In any case how I can take the result I need ?

  In theory, you could just apply that PRAGMA.  That's a rather 
  dangerous thing to do, however, and is very likely to break if the
  environment changes in any way.  
  
  At the end of the day, the application code is making incorrect 
  assumptions about the data layout, expecting an undefinable order
  type.  It is the application code that needs to get fixed to accept
  data in an order that the SQL standard can provide.  This isn't true
  of only SQLite, but all SQL database systems.

   -j

-- 
Jay A. Kreibich < J A Y  @  K R E I B I.C H >

"Intelligence is like underwear: it is important that you have it,
 but showing it to the wrong people has the tendency to make them
 feel uncomfortable." -- Angela Johnson
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to