Re: [sqlite] how to pass -Dxxx compile option

2020-01-09 Thread Xingwei Lin
Thanks all the nice guys' reply!!

On Thu, Jan 9, 2020 at 10:59 PM Gary R. Schmidt  wrote:

> On 09/01/2020 17:47, Xingwei Lin wrote:
> > Hi,
> >
> > How can I pass -Dxxx compile option when I build sqlite? Such as, -
> > DSQLITE_ENABLE_INTERNAL_FUNCTIONS.
> >
> ./configure --help will tell you that CFLAGS is how you do that, so:
>
>  ./configure CFLAGS=-Dwhatever
>
> If you have many options:
>
>  ./configure CFLAGS="-Dwhatever -Dthis -Dthat -mwhoops"
>
> Cheers,
> GaryB-)
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


-- 
Best regards,
Xingwei Lin
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Assertion `memIsValid(pCtx->argv[i])' failed.

2020-01-09 Thread Yongheng Chen
The error pic got stripped. It was 
"Database error: SQL logic error: {DELETE FROM ftsidx WHERE docid IN (SELECT 
rowid FROM ftsdocs WHERE type='t' AND rid=0 AND idxed)}”



> On Jan 9, 2020, at 7:17 PM, Yongheng Chen  wrote:
> 
> Hi,
> 
> We found an assertion failed in sqlite. Here’s the POC:
> —
> CREATE TABLE v0 ( v1 INT CHECK( datetime ( ( NULL ) ,( '1995-09-01' ) ,( 
> 'GERMANY' ) ,( 'MED P' ) ,( 'abc' ) ,( 'Y' ) ,( '13' ) ,( 'MED BAG' ) ,( 
> '199419' ) ,( 'LG CASE' ) ,( '1995-09-01' ) ,( 'SM BOX' ) ,( '' ) 
> ,( 'a' ) ,( 'c' ) ,( 'LG PACK' ) ,( 'GERMANY' ) ,( 'DELIVER IN PERSON' ) ,( 
> 'EUROPE' ) ,( 'abc' ) ,( 'MED BAG' ) ,( 'integrity-check' ) ,( 'PROMO%%' ) ,( 
> 'integrity-check' ) ,( 'abc' ) ,( '30' ) ,( '%%BRASS' ) ,( 'forest%%' ) ,( 
> 'AIR' ) ,( 'LG PACK' ) ,( 'LG PACK' ) ,( 'LG CASE' ) ,( 'GERMANY' 
> ) ,( 'MED PACK' ) ,( 'AIR' ) ,( 'MED PACK' ) ,( '23' ) ,( 'test' ) ,( '31' ) 
> ,( 'Brand#34' ) ,( 'PROMO%%' ) ,( '1995-03-15' ) ,( 'PROMO%%' ) ,( 'X' ) ,( 
> '**%s**' ) ,( 'forest%%' ) ,( 10 ) ,( NULL ) , v1 ) = v1 ) ) ;
> INSERT INTO v0 ( v1 ) VALUES ( 10 ) ,( 9 ) ,( 10 ) ,( 
> '' ) ,( '18' ) ,( 
> 10.10 ) ,( 0 ) ,( 0 ) ,( 10 ) ,( 10 ) ,( 'SM PACK' ) ;
> —-
> 
> This exists in the debug built of latest chunk.
> 
> We tried reporting it by opening a ticket. But I met a the following problem 
> when submitting it:
> 
> 
> 
> Yongheng & Rui

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


[sqlite] Assertion `memIsValid(pCtx->argv[i])' failed.

2020-01-09 Thread Yongheng Chen
Hi,

We found an assertion failed in sqlite. Here’s the POC:
—
CREATE TABLE v0 ( v1 INT CHECK( datetime ( ( NULL ) ,( '1995-09-01' ) ,( 
'GERMANY' ) ,( 'MED P' ) ,( 'abc' ) ,( 'Y' ) ,( '13' ) ,( 'MED BAG' ) ,( 
'199419' ) ,( 'LG CASE' ) ,( '1995-09-01' ) ,( 'SM BOX' ) ,( '' ) 
,( 'a' ) ,( 'c' ) ,( 'LG PACK' ) ,( 'GERMANY' ) ,( 'DELIVER IN PERSON' ) ,( 
'EUROPE' ) ,( 'abc' ) ,( 'MED BAG' ) ,( 'integrity-check' ) ,( 'PROMO%%' ) ,( 
'integrity-check' ) ,( 'abc' ) ,( '30' ) ,( '%%BRASS' ) ,( 'forest%%' ) ,( 
'AIR' ) ,( 'LG PACK' ) ,( 'LG PACK' ) ,( 'LG CASE' ) ,( 'GERMANY' ) 
,( 'MED PACK' ) ,( 'AIR' ) ,( 'MED PACK' ) ,( '23' ) ,( 'test' ) ,( '31' ) ,( 
'Brand#34' ) ,( 'PROMO%%' ) ,( '1995-03-15' ) ,( 'PROMO%%' ) ,( 'X' ) ,( 
'**%s**' ) ,( 'forest%%' ) ,( 10 ) ,( NULL ) , v1 ) = v1 ) ) ;
INSERT INTO v0 ( v1 ) VALUES ( 10 ) ,( 9 ) ,( 10 ) ,( 
'' ) ,( '18' ) ,( 
10.10 ) ,( 0 ) ,( 0 ) ,( 10 ) ,( 10 ) ,( 'SM PACK' ) ;
—-

This exists in the debug built of latest chunk.

We tried reporting it by opening a ticket. But I met a the following problem 
when submitting it:



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


[sqlite] Bad Declaration in fossildelta.c

2020-01-09 Thread Keith Medcalf

static const enc = SQLITE_UTF8|SQLITE_INNOCUOUS;

should that be 

static const int enc = SQLITE_UTF8|SQLITE_INNOCUOUS;

gcc (MinGW) 8.1 complains but assumes that was what was meant...

-- 
The fact that there's a Highway to Hell but only a Stairway to Heaven says a 
lot about anticipated traffic volume.



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


Re: [sqlite] how to pass -Dxxx compile option

2020-01-09 Thread Stephan Buchert
I have an executable file myconfigure with

./configure CFLAGS="-O2 -DSQLITE_MAX_COLUMN=4096 -DHAVE_FDATASYNC
-DHAVE_STRCHRNUL -DHAVE_LOCALTIME_R -DHAVE_GMTIME_R -DHAVE_NAN
-DHAVE_USLEEP -DSQLITE_DEFAULT_WORKER_THREADS=4 -DSQLITE_TEMP_STORE=2
-DSQLITE_USE_URI -DSQLITE_ENABLE_API_ARMOR
-DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_DBSTAT_VTAB
-DSQLITE_ENABLE_EXPLAIN_COMMENTS -DSQLITE_ENABLE_FTS5
-DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_PREUPDATE_HOOK
-DSQLITE_ENABLE_PREUPDATE_HOOK -DSQLITE_ENABLE_MEMORY_MANAGEMENT
-DSQLITE_MAX_MMAP_SIZE=4393751543808
-DSQLITE_DEFAULT_MMAP_SIZE=2194728288256
-DSQLITE_DEFAULT_CACHE_SIZE=-8000 -DSQLITE_DEFAULT_WORKER_THREADS=4
-DSQLITE_ENABLE_MEMSYS5 -DSQLITE_ENABLE_STMTVTAB -DSQLITE_ENABLE_RTREE
-DSQLITE_ENABLE_GEOPOLY -DSQLITE_ENABLE_STAT4
-DSQLITE_ENABLE_UNLOCK_NOTIFY -DSQLITE_ENABLE_NULL_TRIM
-DSQLITE_ENABLE_OFFSET_SQL_FUNC" LIBS="-lm"

(everything on one line) and execute it instead of "configure" whenever
there is an update of Sqlite. Then "make" and "sudo make install".
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] how to pass -Dxxx compile option

2020-01-09 Thread Gary R. Schmidt

On 09/01/2020 17:47, Xingwei Lin wrote:

Hi,

How can I pass -Dxxx compile option when I build sqlite? Such as, -
DSQLITE_ENABLE_INTERNAL_FUNCTIONS.


./configure --help will tell you that CFLAGS is how you do that, so:

./configure CFLAGS=-Dwhatever

If you have many options:

./configure CFLAGS="-Dwhatever -Dthis -Dthat -mwhoops"

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


Re: [sqlite] how to pass -Dxxx compile option

2020-01-09 Thread Warren Young
On Jan 9, 2020, at 6:51 AM, Warren Young  wrote:
> 
>./configure CFLAGS='-DSQLITE_ENABLE_INTERNAL_FUNCTIONS'
> 
> The reasons for the recommendation have to do with complications that result 
> from multiple variables, nested Makefile.am, etc.

It also allows autoreconf to work properly in the case of Autoconf and 
@AUTOREMAKE@ in the case of Autosetup.

To see it, try this in the Fossil source tree to produce a debuggable build:

./configure CFLAGS='-O0 -g'

Then look at the rule generated at the end for re-generating the Makefile:

Makefile: ./Makefile.in …noise noise noise…
/path/to/configure CFLAGS=-O0
touch /path/to/Makefile

You don’t get that by exporting CFLAGS as an environment variable, for example.
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] how to pass -Dxxx compile option

2020-01-09 Thread Warren Young
On Jan 9, 2020, at 6:37 AM, Richard Hipp  wrote:
> 
> On 1/9/20, Xingwei Lin  wrote:
>> 
>> How can I pass -Dxxx compile option when I build sqlite? Such as, -
>> DSQLITE_ENABLE_INTERNAL_FUNCTIONS.
> 
> Option 1:
> 
> CFLAGS='-O2 -DSQLITE_ENABLE_INTERNAL_FUNCTIONS' ./configure && make
> 
> Option 2:
> 
> ./configure && OPTS='-DSQLITE_ENABLE_INTERNAL_FUNCTIONS' make -e
> 
> Option 3:
> 
> ./configure && make OPTS='-DSQLITE_ENABLE_INTERNAL_FUNCTIONS’

…or the one actually recommended by the Autoconf developers:

./configure CFLAGS='-DSQLITE_ENABLE_INTERNAL_FUNCTIONS'

The reasons for the recommendation have to do with complications that result 
from multiple variables, nested Makefile.am, etc.:


https://www.gnu.org/software/automake/manual/html_node/Flag-Variables-Ordering.html

I assume SQLite’s Autoconf usage isn’t complicated enough that all of that 
applies, but you want to get into the habit of doing it the way that works 
across the broadest set of use cases.

Incidentally, this method of overriding CFLAGS and such also works with 
Autosetup.  See the second example here:

https://msteveb.github.io/autosetup/user/
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] how to pass -Dxxx compile option

2020-01-09 Thread Richard Hipp
On 1/9/20, Xingwei Lin  wrote:
> Hi,
>
> How can I pass -Dxxx compile option when I build sqlite? Such as, -
> DSQLITE_ENABLE_INTERNAL_FUNCTIONS.
>

Option 1:

CFLAGS='-O2 -DSQLITE_ENABLE_INTERNAL_FUNCTIONS' ./configure && make

Option 2:

./configure && OPTS='-DSQLITE_ENABLE_INTERNAL_FUNCTIONS' make -e

Option 3:

./configure && make OPTS='-DSQLITE_ENABLE_INTERNAL_FUNCTIONS'

-- 
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 pass -Dxxx compile option

2020-01-09 Thread Kees Nuyt
On Thu, 9 Jan 2020 14:47:44 +0800, you wrote:

> Hi,
>
> How can I pass -Dxxx compile option when I build sqlite? Such as, -
> DSQLITE_ENABLE_INTERNAL_FUNCTIONS.

I don't consider myself an expoert, but the script
below works for me on a Raspberry Pi, Raspbian Jessie.
Note: instead of readline I use the linenoise lib 
that is shipped with fossil. Also, I built a few
of the tools at the same time.
You may have to tweak this a little for your preferences and your platform.

cd ~/src/sqlite
test ! -z "$opt_p" && fossil pull --verbose
test ! -z "$opt_u" && fossil update trunk

OPTS=-DHAVE_LINENOISE
export CPPFLAGS="-DSQLITE_ENABLE_API_ARMOR \
-DSQLITE_ENABLE_COLUMN_METADATA \
-DSQLITE_ENABLE_DBPAGE_VTAB \
-DSQLITE_ENABLE_DBSTAT_VTAB \
-DSQLITE_ENABLE_DESERIALIZE \
-DSQLITE_ENABLE_EXPLAIN_COMMENTS \
-DSQLITE_ENABLE_FTS5 \
-DSQLITE_ENABLE_HIDDEN_COLUMNS \
-DSQLITE_ENABLE_JSON1 \
-DSQLITE_ENABLE_MEMSYS5 \
-DSQLITE_ENABLE_NORMALIZE \
-DSQLITE_ENABLE_OFFSET_SQL_FUNC \
-DSQLITE_ENABLE_PREUPDATE_HOOK \
-DSQLITE_ENABLE_RBU \
-DSQLITE_ENABLE_RTREE \
-DSQLITE_ENABLE_GEOPOLY \
-DSQLITE_ENABLE_STMT_SCANSTATUS \
-DSQLITE_ENABLE_STMTVTAB \
-DSQLITE_ENABLE_UNKNOWN_SQL_FUNCTION \
-DSQLITE_ENABLE_UNLOCK_NOTIFY \
-DSQLITE_ENABLE_UPDATE_DELETE_LIMIT \
-DSQLITE_INTROSPECTION_PRAGMAS \
-DSQLITE_SOUNDEX \
-DSQLITE_USE_URI \
-DSQLITE_SECURE_DELETE \
-DSQLITE_DQS=0 \
-DSQLITE_DEFAULT_WAL_SYNCHRONOUS=1"
./configure \
--prefix=/usr/local \
--libdir=/usr/lib/arm-linux-gnueabihf \
--enable-load-extension \
--enable-threadsafe \
--with-readline-lib=auto \
--with-pic \
--with-gnu-ld \
--enable-json1 \
--enable-fts5 \
--enable-rtree \
--enable-session \
--enable-update-limit \
--enable-geopoly \
--enable-tcl \
--disable-debug \
--disable-static \
&& make clean
&& make sqlite3.c \
&& make shell.c \
&& gcc $OPTS $CPPFLAGS \
-I ../fossil/src \
-L /usr/lib/arm-linux-gnueabihf -ltcl8.6 -lm -ldl -lz -lpthread \
shell.c ../fossil/src/linenoise.c sqlite3.c -o sqlite3 \
&& make sqlite3_analyzer \
&& make sqldiff \
&& make scrub \
&& make showdb \
&& make showwal \
&& make showshm \
&& make wordcount


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


Re: [sqlite] NOTNULL

2020-01-09 Thread Luuk


On 8-1-2020 12:15, R Smith wrote:

I find the keyword NOTNULL listed among known SQLite keywords -
no. 88 on this page: https://sqlite.org/lang_keywords.html

But cannot find a single mention of it or place to use it in SQLite, 
nor get any hit on the sqlite.org search except in reference to the 
above list.


1. What is it for?

2. Does it have/need any documentation?


(from: https://sqlite.org/changes.html  )


 2001-10-02 (2.0.1)

1. 
2. ...
3. Extend the expression syntax to support "expr NOT NULL" (with a
   space between the "NOT" and the "NULL") in addition to "expr
   NOTNULL" (with no space).

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


Re: [sqlite] how to pass -Dxxx compile option

2020-01-09 Thread Niall O'Reilly
On 9 Jan 2020, at 9:41, Xingwei Lin wrote:

> I always use ./configure && make to compile sqlite.
>
> ./configure can add some compile options, but I don't know how to add -Dxxx
> option in this compilation process.

I don't know (since I've never needed to build SQLite),
but can offer a hint which may help you discover for yourself
while waiting for real expert advice.

Just before sending, I did check my incoming mail, and didn't see
anything from a real expert yet.

After running ./configure (without && make), inspect the Makefile
and try to find how it runs the compiler, and how it passes options
to the compiler.  The man page for make is worth reading, but can
be confusing.

The Makefiles for other software packages that I have to build
from time to time are written following the convention that the
compiler is invoked using a macro CC, and that options are passed
to it using a macro CFLAGS.

If you find lines like
  $(CC) ... $(CFLAGS) ...
then you can set a value for CFLAGS by giving an argument to make:
  make CFLAGS=-Dxxx
If you see lines like
  CFLAGS = $(SOMEFLAGS) $(MOREFLAGS) $(EXTRAFLAGS)
then you'll need to be more careful, and work out which of the
macros on the right-hand side should be over-ridden by the
argument to make.

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


Re: [sqlite] how to pass -Dxxx compile option

2020-01-09 Thread Xingwei Lin
Thanks for reply.

I always use ./configure && make to compile sqlite.

./configure can add some compile options, but I don't know how to add -Dxxx
option in this compilation process.

On Thu, Jan 9, 2020 at 5:29 PM Simon Slavin  wrote:

> On 9 Jan 2020, at 6:47am, Xingwei Lin  wrote:
>
> > How can I pass -Dxxx compile option when I build sqlite? Such as, -
> > DSQLITE_ENABLE_INTERNAL_FUNCTIONS.
>
> Depends on which compiler you're using.  See examples for gcc on this page:
>
> 
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


-- 
Best regards,
Xingwei Lin
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] how to pass -Dxxx compile option

2020-01-09 Thread Simon Slavin
On 9 Jan 2020, at 6:47am, Xingwei Lin  wrote:

> How can I pass -Dxxx compile option when I build sqlite? Such as, -
> DSQLITE_ENABLE_INTERNAL_FUNCTIONS.

Depends on which compiler you're using.  See examples for gcc on this page:


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