Re: [sqlite] Order of UNION query results

2011-01-23 Thread Josh Gibbs
Excellent and perfect solution to my problem.  Thanks Richard.


On 23/01/2011 2:16 a.m., Richard Hipp wrote:
 On Fri, Jan 21, 2011 at 6:53 PM, Josh Gibbsjgi...@di.co.nz  wrote:

 Could someone please clarify for me if the the resulting order of a UNION
 query will come back with the left data first, then the right data in
 the case
 that no ordering has been defined for the query.

 My need is to have a parameter stored in a database, with an optional
 overriding parameter which should take precedence, such as:

 select value from param_overrides where key='setting' UNION
 select value from params where key='setting'

 SELECT coalesce(
  (SELECT value FROM param_overrides WHERE key='setting'),
  (SELECT value FROM param WHERE key='setting)
 );

 This approach above has the advantage that it never evaluates the second
 query if the first query is successful.



 I'd like the resulting recordset to always contain the override parameter
 first if it exists so I can simply use that value.

 Thanks, Josh


 ___
 sqlite-users mailing list
 sqlite-users@sqlite.org
 http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users





___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] REGEXP parameter order

2011-01-23 Thread Jean-Christophe Deschamps
Hi all,

Sorry for elementary questions but when implementing a REGEXP function 
(I'm using PCRE from pcre.org) I need to know in which order the two 
arguments (target, pattern) will be passed to the function.

I also would like to retain the last pattern used in compiled form 
(connection-wise).  Is the use of sqlite3_get_auxdata possible in this 
context as it is in overriding LIKE functions, for instance?

Thank you.

___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] REGEXP parameter order

2011-01-23 Thread Richard Hipp
On Sun, Jan 23, 2011 at 5:02 PM, Jean-Christophe Deschamps 
j...@q-e-d.orgwrote:

 Hi all,

 Sorry for elementary questions but when implementing a REGEXP function
 (I'm using PCRE from pcre.org) I need to know in which order the two
 arguments (target, pattern) will be passed to the function.

 I also would like to retain the last pattern used in compiled form
 (connection-wise).  Is the use of sqlite3_get_auxdata possible in this
 context as it is in overriding LIKE functions, for instance?


REGEXP works just like LIKE and GLOB.



 Thank you.

 ___
 sqlite-users mailing list
 sqlite-users@sqlite.org
 http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users




-- 
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users