Re: [sqlite] Build SQLite.Interop for MAC

2018-07-27 Thread Jens Alfke


> On Jul 20, 2018, at 10:06 AM, Victor Da Costa 
>  wrote:
> 
> After building the library my application seems to detect it but I get this
> error on the Password field :
> 
> System.EntryPointNotFoundException: Unable to find an entry point named
> "sqlite3_rekey" in DLL "sqlite3"

sqlite3_rekey is only available in builds of SQLite with encryption support. 
(That would be SQLite's own SQLite Encryption Extension, or SQLCipher.)

> So I decided to add -DSQLITE_HAS_CODEC=1 to the building script. And now it
> doesn't build anymore I get these errors : 

You've enabled the encryption API, but that doesn't actually add the code that 
does the encryption, which is where the link errors come from. You need to look 
at either SQLite Encryption Extension or SQLCipher, if you need to use 
encryption. Otherwise, you should disable the code that's calling sqlite3_rekey.

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


[sqlite] SQLite 3.24.0 Solaris 9 build failure

2018-07-27 Thread Andy Goth
SQLite 3.24.0 fails to build on Solaris 9 (a.k.a. Solaris 2.9) due to 
not finding fchmod, fchown, readlink, lstat, usleep, struct timeval, and 
gettimeofday.


To correct, do not #define _XOPEN_SOURCE.  There's already a check for 
Mac OS X, so I would suggest extending the check to also exclude Solaris 
9 with something like the following:


#if !defined(_XOPEN_SOURCE) && !defined(__DARWIN__) && !defined(__APPLE) 
&& \

!(defined(__sun) && defined(__SVR4))
#  define _XOPEN_SOURCE 600
#endif

This check isn't version-specific.  There doesn't appear to be a 
guaranteed macro for that purpose.  Sun Studio offers macros like 
_SunOS_5_9 (meaning Solaris 9), but gcc does not.  Though it's a bit 
silly for me to obsess over versions since I don't know exactly which 
versions of Solaris hide the relevant functions and structs if 
_XOPEN_SOURCE is defined.  I only have access to Solaris 9, and by 
"access" I mean I have a copy of /usr/include and such, not a computer I 
can log in to.  Just enough to do a cross-compile, which succeeds with 
the above change.


More investigation is needed to figure out how to make SQLite build for 
Solaris 9 without breaking other Solaris/SunOS platforms.


--
Andy Goth | 
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Create VIEW passing despite invalid column name specified

2018-07-27 Thread Simon Slavin
There is very little pressure to keep the shell tool small.  So the check for 
views which refer to non-existent tables could be put into there, as part of 
one of the dot-commands which do checking.

As for the code, it doesn't require anything more than SQL commands.  There's 
no need for access to any SQLite internals.  The code posted by Ryan Smith 
upthread is a good demonstration of how to manage that check without using 
SQLite internals.

But if you distrust your schema so much that you want to sanity-checking VIEWs, 
you want to sanity-check TRIGGERs too, since they also have deferred 
entity-checking.  And that is far more difficult.

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


Re: [sqlite] Create VIEW passing despite invalid column name specified

2018-07-27 Thread R Smith


On 2018/07/27 1:59 PM, Dominique Devienne wrote:


Sigh. We already have 4 different check pragmas (cell-size, fk, integrity,
quick).
One more for views seems perfectly in line with those. Did anyone raise the
same
old light-code-bloat argument for those too, in the past? I for one cringe
every time
I read it nowadays. In any case, it's always entirely at the discretion of
DRH, and
although he of course considers the communities views (pun intended) I'm
sure,
at the end of the day he's the sole decider.


Yeah, I meant Richard (or one of the  devs at least) - apologies, I 
assumed that was obvious.






One caution, some views that have ordered sub-selects linked to very
large tables (or other stuff I don't know about) might take a long time
to even simply prepare - so perhaps not a good idea to automatically add
this after every script.


Really? I've never heard that preparing a statement depended on how large
tables accessed are.
Doesn't prepare only ever cares about data dictionaries (i.e. DDL stuff)
and not actual rows (DML stuff)?

Preparing is not only running the SQL parser and generating the VDBE
program for that statement?
If what you wrote was true, wouldn't that imply the result of prepare could
be different depending if the
prepare happens with a empty or "full" table? Or I completely misunderstood
your "large table" comment?


It's not the size of a direct table that matters, it's only when part of 
a sub-query that needs to be evaluated. At least, that's how I have it - 
I could be wrong.


I'm hoping someone who understands the internal mechanism more fully can 
provide a clear example. It might also be that it is simply required 
before the first step() and not during the prepare per sé. Last 
discussion on this was many moons and many versions of sqlite ago, too 
long for me to trust my memory.


So before propagating any misinformation, I'll appeal to the devs (or 
anyone who knows for sure), and ask:
Is there ever a reason the "sqlite3_prepare()" and its ilk can take 
longer than a few milliseconds?  If so, how?



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


Re: [sqlite] Create VIEW passing despite invalid column name specified

2018-07-27 Thread Dominique Devienne
On Fri, Jul 27, 2018 at 11:33 AM R Smith  wrote:

> On 2018/07/27 10:40 AM, Dominique Devienne wrote:
> > On Fri, Jul 27, 2018 at 1:58 AM Richard Hipp  wrote:
> >> On 7/26/18, Tomasz Kot  wrote:
> >>> Beneath sql shall throw an error on  CREATE VIEW statement (as invalid
> >>> column is specified), but it passes (SQLite 3.23.1).
> >> The error is deferred until you try to use the view.  The reason for
> >> deferring the error is that the problem might be corrected by
> >> subsequent DDL statements prior to using the view.
> >>
> > Would it be possible to have a pragma that easily detects all invalid
> views?
> > Does an existing one already do that? That would be useful IMHO.
>
> I'm sure it is possible, though you will probably receive the usual
> "code bloat avoidance" reply (which I tend to agree with).
>

Sigh. We already have 4 different check pragmas (cell-size, fk, integrity,
quick).
One more for views seems perfectly in line with those. Did anyone raise the
same
old light-code-bloat argument for those too, in the past? I for one cringe
every time
I read it nowadays. In any case, it's always entirely at the discretion of
DRH, and
although he of course considers the communities views (pun intended) I'm
sure,
at the end of the day he's the sole decider.


> That said, it's easy to do in a bit of code which you can add to your
> libraries as a standard function, which will go something like this (in
> pseudo):
>

Of course it is. But many many people use SQLite entirely via sqlite3[.exe]
with
no C code extensions of their own.


> Which you can spruce up by adding the actual sqlite error return code or
> description.
> You can also UNION in the sqlite_temp_master to check temporary views if
> needed.
>

Some pragmas AFAIK, are already DB aware and can restrict themselves to a
given attached DB.


> One caution, some views that have ordered sub-selects linked to very
> large tables (or other stuff I don't know about) might take a long time
> to even simply prepare - so perhaps not a good idea to automatically add
> this after every script.
>

Really? I've never heard that preparing a statement depended on how large
tables accessed are.
Doesn't prepare only ever cares about data dictionaries (i.e. DDL stuff)
and not actual rows (DML stuff)?

Preparing is not only running the SQL parser and generating the VDBE
program for that statement?
If what you wrote was true, wouldn't that imply the result of prepare could
be different depending if the
prepare happens with a empty or "full" table? Or I completely misunderstood
your "large table" comment?

Thanks, --DD
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Backup and integrity check questions

2018-07-27 Thread R Smith

On 2018/07/27 12:51 PM, Richard Hipp wrote:


Seem right.  If a change happens to the database in the middle of a
backup, the backup automatically restarts, so that at the end of a
backup you are guaranteed to have a consistent copy from a single
point in time (something that you are not guaranteed to have if you
copy the file externally).


Unless of course you close all connections to the DB first, right?

I think the consideration comes to this:

Using BackUp API:
Advantages
-- No need to close all connections, can back-up a live DB.
-- Will re-start a backup if DB writes take place during.
-- Produces a consistent state file.
-- Can be done using only internal sqlite API (no manual file-handling).

Caveats
-- If updates happen very often on a large-ish DB, the backup may 
constantly re-start and never complete.


Using file-system Copy:
Advantages
-- Quick to backup (OS/FS caching assist)
-- Consistent state single file (provided all DB connections are closed)
-- No restarting, but DB must remain closed (for writing at least) for 
the duration of the Copy.


Caveats
-- Need to do your own file-system handling / error checking.
-- DB has to be closed to force the consistent state single file before 
copying (commit journal files to main DB file).

-- No restarting, so no DB write transactions during copy process.


Conclusion:  Unless you have the rare case of a constantly + frequently 
updated large DB, use the API backup.



(If I've missed a point, or got it wrong, someone please amend it)


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


Re: [sqlite] Backup and integrity check questions

2018-07-27 Thread Richard Hipp
On 7/25/18, Rune Torgersen  wrote:

> Management wants to know if we're doing it correctly, or if there are
> faster/easier ways to do backup (and check).
> Also wants to know if a backup done using the live backup API gives us an
> exact copy (with any possible corruption) or if the backup is regenerated.

Seem right.  If a change happens to the database in the middle of a
backup, the backup automatically restarts, so that at the end of a
backup you are guaranteed to have a consistent copy from a single
point in time (something that you are not guaranteed to have if you
copy the file externally).


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


Re: [sqlite] How to insert this string?

2018-07-27 Thread Bart Smissaert
Thanks for that. A QuotedString function will be useful indeed and will add
that.
In this case my language is B4A, which is similar to the old VB6.
Very good and much recommended.

RBS


On Fri, Jul 27, 2018 at 11:32 AM, R Smith  wrote:

> On 2018/07/27 11:15 AM, Bart Smissaert wrote:
>
>> xxx is an identifier. It has no meaning at all in SQL and needs to be
>> replaced by the app.
>>
>
> Ok, so your app needs to replace xxx with 'A', 'B', 'C' then?
>
> Well, that depends on what language your App is?
>
> For example, assuming the query 'SELECT * FROM table1 WHERE a IN (xxx);'
> is in variable q:
>
> Most languages have some standard function akin to:
>  str_replace(q, "xxx", "'A', 'B', 'C'");   - if the language uses
> double-quotes to quote strings (like VB or PHP), or
>  str_replace(q, 'xxx', '''A'', ''B'', ''C'''); - if the language uses
> single-quotes (like most other).
> (I assume you already knew this already and the question is more towards
> the next bit, but I'm mentioning it since it was asked, and in case you, or
> someone else reading this, did not).
>
> To get the string 'A', 'B', 'C' into a field in a table (from where you
> might query it to replace it with your app as above), that would be:
>
> INSERT INTO t(SearchStr) VALUES ('''A'', ''B'', ''C''');
>
> which is essentially the same as 'A', 'B', 'C' where every single quote is
> duplicated and then all of it is enclosed with an added pair of single
> quotes.
>
> Note that if this is a string inside your single-quote string quoting
> program language, it has to be escaped again, which essentially repeats the
> above process to yield something like:
>
> sQuery = 'INSERT INTO t(SearchStr) VALUES (''A, B,
> C'');';
>
> Though your programming language should have some form of QuotedStr()
> function. If not, this should be easy to translate to your language of
> choice:
>
> function QuotedStr(inputStr) string {
>   s = inputStr;
>   for(i = len(s); i > 0; i--) {
> if ( s[i] = Char(39) )  { insert(s, i, ); }
>   }
>   QuotedStr =  + s + ;
> }
>
> Note that  and Char(39) both denote a single single-quote character in
> string format in a language that uses single quotes to quote strings.
> This could make life easier in that you can simply say something like:
>
> sQuery = 'INSERT INTO t(SearchStr) VALUES (' + QuotedStr('''A'', ''B'',
> ''C''') + ');';
>
> or even (if you prefer bloat over obscurity):
>
> sQuery = 'INSERT INTO t(SearchStr) VALUES (' + QuotedStr( QuotedStr('A') +
> ', ' + QuotedStr('B') + ',  '+ QuotedStr('C') ) + ');';
>
> Hope that makes some sense...
> Ryan
>
>
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] How to insert this string?

2018-07-27 Thread R Smith

On 2018/07/27 11:15 AM, Bart Smissaert wrote:

xxx is an identifier. It has no meaning at all in SQL and needs to be
replaced by the app.


Ok, so your app needs to replace xxx with 'A', 'B', 'C' then?

Well, that depends on what language your App is?

For example, assuming the query 'SELECT * FROM table1 WHERE a IN (xxx);' 
is in variable q:


Most languages have some standard function akin to:
 str_replace(q, "xxx", "'A', 'B', 'C'");       - if the language uses 
double-quotes to quote strings (like VB or PHP), or
 str_replace(q, 'xxx', '''A'', ''B'', ''C'''); - if the language uses 
single-quotes (like most other).
(I assume you already knew this already and the question is more towards 
the next bit, but I'm mentioning it since it was asked, and in case you, 
or someone else reading this, did not).


To get the string 'A', 'B', 'C' into a field in a table (from where you 
might query it to replace it with your app as above), that would be:


INSERT INTO t(SearchStr) VALUES ('''A'', ''B'', ''C''');

which is essentially the same as 'A', 'B', 'C' where every single quote 
is duplicated and then all of it is enclosed with an added pair of 
single quotes.


Note that if this is a string inside your single-quote string quoting 
program language, it has to be escaped again, which essentially repeats 
the above process to yield something like:


sQuery = 'INSERT INTO t(SearchStr) VALUES (''A, B, 
C'');';


Though your programming language should have some form of QuotedStr() 
function. If not, this should be easy to translate to your language of 
choice:


function QuotedStr(inputStr) string {
  s = inputStr;
  for(i = len(s); i > 0; i--) {
    if ( s[i] = Char(39) )  { insert(s, i, ); }
  }
  QuotedStr =  + s + ;
}

Note that  and Char(39) both denote a single single-quote character 
in string format in a language that uses single quotes to quote strings.

This could make life easier in that you can simply say something like:

sQuery = 'INSERT INTO t(SearchStr) VALUES (' + QuotedStr('''A'', ''B'', 
''C''') + ');';


or even (if you prefer bloat over obscurity):

sQuery = 'INSERT INTO t(SearchStr) VALUES (' + QuotedStr( QuotedStr('A') 
+ ', ' + QuotedStr('B') + ',  '+ QuotedStr('C') ) + ');';


Hope that makes some sense...
Ryan

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


Re: [sqlite] [EXTERNAL] How to insert this string?

2018-07-27 Thread Bart Smissaert
Yes, that works indeed. I made a silly mistake and that is that the replace
took already place in the table insertion SQL!
Idea is that users can make a shortcut in the SQL and not type out a long
string every time.
All sorted now.

RBS

On Fri, Jul 27, 2018 at 10:25 AM, Hick Gunter  wrote:

> Insert into sql_replace values ('xxx','''A'',''B'',''C''');
>
> Note: All single quotes. To include a single quote in a single quoted
> string, it needs to be doubled.
>
> Not sure what you are trying to do here. Build SQL queries on the fly?
>
> -Ursprüngliche Nachricht-
> Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org]
> Im Auftrag von Bart Smissaert
> Gesendet: Freitag, 27. Juli 2018 10:38
> An: General Discussion of SQLite Database  sqlite.org>
> Betreff: [EXTERNAL] [sqlite] How to insert this string?
>
> Have a  table like this:
>
> create table sql_replace(string_old text, string_new text)
>
> The idea is to do automatic string replacements in SQL.
> Say we have this SQL:
>
> select * from table1 where a in(xxx)
>
> then after the string replacement it should be this:
>
> select * from table1 where a in('A', 'B', 'C')
>
> Having some  trouble inserting the 2 strings, xxx and 'A', 'B', 'C'
> in the table. Tried various constructions, but getting errors. I can see
> this will be a lot easier to do in code with place holders and bound
> values, but in this case I need to do it with direct SQL in an Android
> phone app.
>
> Any advice how to do this in direct SQL?
>
> RBS
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
>
> ___
>  Gunter Hick | Software Engineer | Scientific Games International GmbH |
> Klitschgasse 2-4, A-1130 Vienna | FN 157284 a, HG Wien, DVR: 0430013 | (O)
> +43 1 80100 - 0
>
> May be privileged. May be confidential. Please delete if not the addressee.
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Create VIEW passing despite invalid column name specified

2018-07-27 Thread R Smith

On 2018/07/27 10:40 AM, Dominique Devienne wrote:

On Fri, Jul 27, 2018 at 1:58 AM Richard Hipp  wrote:


On 7/26/18, Tomasz Kot  wrote:

Hello,

Beneath sql shall throw an error on  CREATE VIEW statement (as invalid
column is specified), but it passes (SQLite 3.23.1).

The error is deferred until you try to use the view.  The reason for
deferring the error is that the problem might be corrected by
subsequent DDL statements prior to using the view.


Would it be possible to have a pragma that easily detects all invalid views?
Does an existing one already do that? That would be useful IMHO.

Someone writing a SQL script to instantiate a schema could run that pragma
at the end,


I'm sure it is possible, though you will probably receive the usual 
"code bloat avoidance" reply (which I tend to agree with).


That said, it's easy to do in a bit of code which you can add to your 
libraries as a standard function, which will go something like this (in 
pseudo):


function check_views {
  Read (SELECT name FROM sqlite_master WHERE type='view') into VList;
  For each name in VList do
    if sql_prepare('SELECT * FROM ' + name)<> SQL_OK
       log( 'View ' + name + ' is not working.');
}

Which you can spruce up by adding the actual sqlite error return code or 
description.
You can also UNION in the sqlite_temp_master to check temporary views if 
needed.


One caution, some views that have ordered sub-selects linked to very 
large tables (or other stuff I don't know about) might take a long time 
to even simply prepare - so perhaps not a good idea to automatically add 
this after every script.


Cheers,
Ryan

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


Re: [sqlite] [EXTERNAL] How to insert this string?

2018-07-27 Thread Hick Gunter
Insert into sql_replace values ('xxx','''A'',''B'',''C''');

Note: All single quotes. To include a single quote in a single quoted string, 
it needs to be doubled.

Not sure what you are trying to do here. Build SQL queries on the fly?

-Ursprüngliche Nachricht-
Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im 
Auftrag von Bart Smissaert
Gesendet: Freitag, 27. Juli 2018 10:38
An: General Discussion of SQLite Database 
Betreff: [EXTERNAL] [sqlite] How to insert this string?

Have a  table like this:

create table sql_replace(string_old text, string_new text)

The idea is to do automatic string replacements in SQL.
Say we have this SQL:

select * from table1 where a in(xxx)

then after the string replacement it should be this:

select * from table1 where a in('A', 'B', 'C')

Having some  trouble inserting the 2 strings, xxx and 'A', 'B', 'C'
in the table. Tried various constructions, but getting errors. I can see this 
will be a lot easier to do in code with place holders and bound values, but in 
this case I need to do it with direct SQL in an Android phone app.

Any advice how to do this in direct SQL?

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


___
 Gunter Hick | Software Engineer | Scientific Games International GmbH | 
Klitschgasse 2-4, A-1130 Vienna | FN 157284 a, HG Wien, DVR: 0430013 | (O) +43 
1 80100 - 0

May be privileged. May be confidential. Please delete if not the addressee.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] How to insert this string?

2018-07-27 Thread Bart Smissaert
xxx is an identifier. It has no meaning at all in SQL and needs to be
replaced by the app.
I have given the SQL string before and after the replacement:

select * from table1 where a in(xxx)

then after the string replacement it should be this:

select * from table1 where a in('A', 'B', 'C')

The problem is how to get the string:
'A', 'B', 'C'
in the table.

RBS


On Fri, Jul 27, 2018 at 10:02 AM, R Smith  wrote:

> On 2018/07/27 10:38 AM, Bart Smissaert wrote:
>
>> Have a  table like this:
>>
>> create table sql_replace(string_old text, string_new text)
>>
>> The idea is to do automatic string replacements in SQL.
>> Say we have this SQL:
>>
>> select * from table1 where a in(xxx)
>>
>> then after the string replacement it should be this:
>>
>> select * from table1 where a in('A', 'B', 'C')
>>
>> Having some  trouble inserting the 2 strings, xxx and 'A', 'B', 'C'
>> in the table. Tried various constructions, but getting errors. I can see
>> this will
>> be a lot easier to do in code with place holders and bound values, but in
>> this
>> case I need to do it with direct SQL in an Android phone app.
>>
>> Any advice how to do this in direct SQL?
>>
>
> This question is not clear.
>
> what does xxx mean? is it an identifier? a constant? a string?
> Whatever it is, once resolved, is it a set of strings, or a single string?
>
> There is no way to change "...WHERE identifier IN (identifier)" into
> "...WHERE identifier IN (identifier, identifier, ...)" via string
> replacement or any other method.
>
> If 'A,B,C' is meant to be a single string, then the "instr()" function
> would get better results than "IN ()".
>
> It's possible that I'm simply completely wrong about what you mean though,
> could you perhaps give 2 examples of the exact syntax you intend before and
> after the replacement (i.e. what exactly will "xxx" be in your example)?
>
>
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] How to insert this string?

2018-07-27 Thread R Smith

On 2018/07/27 10:38 AM, Bart Smissaert wrote:

Have a  table like this:

create table sql_replace(string_old text, string_new text)

The idea is to do automatic string replacements in SQL.
Say we have this SQL:

select * from table1 where a in(xxx)

then after the string replacement it should be this:

select * from table1 where a in('A', 'B', 'C')

Having some  trouble inserting the 2 strings, xxx and 'A', 'B', 'C'
in the table. Tried various constructions, but getting errors. I can see
this will
be a lot easier to do in code with place holders and bound values, but in
this
case I need to do it with direct SQL in an Android phone app.

Any advice how to do this in direct SQL?


This question is not clear.

what does xxx mean? is it an identifier? a constant? a string?
Whatever it is, once resolved, is it a set of strings, or a single string?

There is no way to change "...WHERE identifier IN (identifier)" into 
"...WHERE identifier IN (identifier, identifier, ...)" via string 
replacement or any other method.


If 'A,B,C' is meant to be a single string, then the "instr()" function 
would get better results than "IN ()".


It's possible that I'm simply completely wrong about what you mean 
though, could you perhaps give 2 examples of the exact syntax you intend 
before and after the replacement (i.e. what exactly will "xxx" be in 
your example)?



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


Re: [sqlite] Backup and integrity check questions

2018-07-27 Thread chelle...@sky.com


On Fri, 27/7/18, Simon Slavin  wrote:

 Subject: Re: [sqlite] Backup and integrity check questions
 To: "SQLite mailing list" 
 Date: Friday, 27 July, 2018, 6:35
 
 On 27 Jul 2018, at 6:02am, Rowan
 Worth 
 wrote:
 
 > (any writes to
 a DB are automatically propagated to in-progress backups
 > within the same process).
 
 I didn't know that. 
 Thanks.  It's clever.
 
 Simon.
 ___
 sqlite-users mailing list
 sqlite-users@mailinglists.sqlite.org
 http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
 
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] How to insert this string?

2018-07-27 Thread Bart Smissaert
Have a  table like this:

create table sql_replace(string_old text, string_new text)

The idea is to do automatic string replacements in SQL.
Say we have this SQL:

select * from table1 where a in(xxx)

then after the string replacement it should be this:

select * from table1 where a in('A', 'B', 'C')

Having some  trouble inserting the 2 strings, xxx and 'A', 'B', 'C'
in the table. Tried various constructions, but getting errors. I can see
this will
be a lot easier to do in code with place holders and bound values, but in
this
case I need to do it with direct SQL in an Android phone app.

Any advice how to do this in direct SQL?

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


Re: [sqlite] Create VIEW passing despite invalid column name specified

2018-07-27 Thread Dominique Devienne
On Fri, Jul 27, 2018 at 1:58 AM Richard Hipp  wrote:

> On 7/26/18, Tomasz Kot  wrote:
> > Hello,
> >
> > Beneath sql shall throw an error on  CREATE VIEW statement (as invalid
> > column is specified), but it passes (SQLite 3.23.1).
>
> The error is deferred until you try to use the view.  The reason for
> deferring the error is that the problem might be corrected by
> subsequent DDL statements prior to using the view.
>

Would it be possible to have a pragma that easily detects all invalid views?
Does an existing one already do that? That would be useful IMHO.

Someone writing a SQL script to instantiate a schema could run that pragma
at the end,
with -bail perhaps, to eagerly and easily validate the DDL script. My
$0.02. --DD
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users