Re: [sqlite] Question about C# with SQLite

2016-07-07 Thread Shouwei Li
oops!
This is exactly the solution.
Thank you soo much!

On Tue, Jul 5, 2016 at 3:50 PM, Chris Locke  wrote:

> Possible solution from StackOverflow:
> Try setting the Build Action property of the source DLLs to None
>
> On Tue, Jul 5, 2016 at 1:18 PM, Shouwei Li  wrote:
>
> > Hi, guys,
> >
> > Thank you very much for your reply.
> >
> > Just make a conclusion, I followed the solution provided in this link,
> and
> > my program could be run on any PC now.
> > https://rashimuddin.wordpress.com/tag/sqlite-interop-dll/
> >
> > But another issue comes out now, I always get this warning when build the
> > whole solution.
> >
> > 1>C:\Program Files
> > (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(3506,5):
> > warning MSB3178: Assembly 'SQLite\System.Data.SQLite.dll' is incorrectly
> > specified as a file.
> >
> > It not affect the final release program, but I don't know how it comes
> from
> > and how to eliminate it.
> >
> > Thank you!
> >
> >
> >
> > On Tue, Jul 5, 2016 at 9:37 AM, Chris Locke 
> > wrote:
> >
> > > You might need something like Microsofts Process Monitor.
> > >
> > >
> >
> https://technet.microsoft.com/en-us/sysinternals/processmonitor.aspx?f=255=-2147217396
> > >
> > > I was getting similar 'red herrings' when deploying my .exe and
> > > system.data.sqlite.dll - it was moaning that it couldn't load the DLL.
> > > Indeed it couldn't, as it also needed msvcr100.dll, which wasn't on the
> > > users machine.  This only came to light when I used the above program
> and
> > > noticed the error produced when it was looking for the file that wasn't
> > > there
> > >
> > >
> > > Chris
> > >
> > > On Tue, Jul 5, 2016 at 4:59 AM, dandl  wrote:
> > >
> > > > Did you mean: SQLite.Intero.dll or SQLite.Interop.dll?
> > > >
> > > > Did you put it in the right place?
> > > >
> > > > Also consider the question of 32 vs 64 bit.
> > > >
> > > > Did you try Stack Overflow? There are lots of hits over there.
> > > >
> > > > Regards
> > > > David M Bennett FACS
> > > >
> > > > Andl - A New Database Language - andl.org
> > > >
> > > >
> > > >
> > > > > -Original Message-
> > > > > From: sqlite-users-boun...@mailinglists.sqlite.org [mailto:
> > > sqlite-users-
> > > > > boun...@mailinglists.sqlite.org] On Behalf Of J Decker
> > > > > Sent: Tuesday, 5 July 2016 12:57 PM
> > > > > To: SQLite mailing list 
> > > > > Subject: Re: [sqlite] Question about C# with SQLite
> > > > >
> > > > > if it was built with debug mode; probably the debug runtime doesn't
> > > exist
> > > > > there.  Otherwise it's because the visual studio runtime required
> > isn't
> > > > > available.
> > > > >
> > > > > On Mon, Jul 4, 2016 at 6:52 AM, Shouwei Li 
> wrote:
> > > > >
> > > > > > Hi there,
> > > > > >
> > > > > > I have a project developed with .net 2015 and C#. I use SQLite as
> > the
> > > > > > server-less database. It works very well in my workstation. But
> it
> > > can
> > > > > > not run on other PC. The error indicates:
> > > > > >
> > > > > > Unable to load DLL "SQLite.Intero.dll": The specified module
> could
> > > not
> > > > > > be found.
> > > > > >
> > > > > > I already attach this dll with my program.
> > > > > >
> > > > > > I want to ask is there a manual talk about how to deploy a
> program
> > to
> > > > > > customer when we use the SQLite database.
> > > > > >
> > > > > > Thanks for your reading.
> > > > > >
> > > > > > --
> > > > > > Best Regards!
> > > > > > Shouwei Li
> > > > > > ___
> > > > > > 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-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
> > >
> >
> >
> >
> > --
> > Best Regards!
> > Shouwei Li
> > ___
> > 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
>



-- 
Best Regards!
Shouwei Li

Re: [sqlite] Formal specification for sqlite3 file format

2016-07-07 Thread Bayer
The British National Archives has registered SQLite3 among its 
identified file formats (see PRONOM at 
http://www.nationalarchives.gov.uk/pronom/Default.aspx) and given it the 
following PUID: fmt/729.


The U.S. Library of Congress has included SQLite3 in its Recommended 
Formats Statement for the digital preservation of datasets 
(http://www.loc.gov/preservation/resources/rfs/data.html).


Hope this helps.


Am 08.07.2016 um 04:17 schrieb Richard Hipp:

On 7/7/16, Henry Chan  wrote:

Dear all,

I'm wondering if there is any "formal" specification for the sqlite3
application format, as in standardized as an ISO/IEC standard, ECMA
standard or RFC?

How does one go about getting a long-established file format such as
SQLite "formalized"?


This is similar to .DOCX being registered as both ISO/IEC 29500
and ECMA-376; JSON being RFC 7159 and ECMA-404, XML being a W3C
specification with various parts as RFC.

Without a "formal" specification, it makes it (unnecessarily) "hard" for
governments to adopt SQLite3's database file as an application format as an
official formats for information exchange.

Such a "formal" specification would simply be a stripped down version of
Section 1 of http://www.sqlite.org/fileformat2.html, where all the reasons
for quirks or definite behavior are stripped and all values could be
described in the database' committed state.


Yours,
Henry
___
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] Downloading SQLite issue

2016-07-07 Thread Richard Hipp
On 7/7/16, Alex Fender  wrote:
> When I download SQLite for Mac, when I extract the file out of the zip and
> open, the files are damaged. How can I download a file that is not damaged?

I click on the link using Firefox and it downloads and unzips to my
Mac just fine.

What are you doing that is not working for you?
-- 
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


[sqlite] Downloading SQLite issue

2016-07-07 Thread Alex Fender
When I download SQLite for Mac, when I extract the file out of the zip and
open, the files are damaged. How can I download a file that is not damaged?

-- 

Alex Fender

Funnel Scientist

*Funnel Science Internet Marketing LLC *

*Office* 972-867-3100 <%28972%29%20867-3100> *| Cell* 214-625-9023 *| *
FunnelScience.com 
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Formal specification for sqlite3 file format

2016-07-07 Thread Richard Hipp
On 7/7/16, Henry Chan  wrote:
> Dear all,
>
> I'm wondering if there is any "formal" specification for the sqlite3
> application format, as in standardized as an ISO/IEC standard, ECMA
> standard or RFC?

How does one go about getting a long-established file format such as
SQLite "formalized"?

>
> This is similar to .DOCX being registered as both ISO/IEC 29500
> and ECMA-376; JSON being RFC 7159 and ECMA-404, XML being a W3C
> specification with various parts as RFC.
>
> Without a "formal" specification, it makes it (unnecessarily) "hard" for
> governments to adopt SQLite3's database file as an application format as an
> official formats for information exchange.
>
> Such a "formal" specification would simply be a stripped down version of
> Section 1 of http://www.sqlite.org/fileformat2.html, where all the reasons
> for quirks or definite behavior are stripped and all values could be
> described in the database' committed state.
>
>
> Yours,
> Henry
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


-- 
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] sqldiff wrong quoting

2016-07-07 Thread Richard Hipp
On 7/6/16, Francesco Frassinelli  wrote:
> Hi,
> it looks like sqldiff can't handle special characters like `%`:

Thanks.  Bug fixed here: https://www.sqlite.org/src/info/8bb8d886ffa948cd

>
> $ sqlite3 %.db
> SQLite version 3.13.0 2016-05-18 10:57:30
> Enter ".help" for usage hints.
> sqlite> CREATE TABLE test (`%` REAL);
> sqlite>
>
> $ sqldiff %.db %.db
> sqldiff: SQL statement error: unrecognized token: """
> "SELECT B.rowid, 1, -- changed row
>A.""
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


-- 
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] Help Installing SQLite on a Windows 8.1 PC

2016-07-07 Thread Donald Griggs
Hi Krista,

Regarding: I have downloaded the two 64-bit Windows files on my Windows 8.1
PC,

Are you referring to sqlite.exe and maybe sqlite.dll ?


Regarding:  but I cannot get SQLite to install on my PC.

I'm not sure I understand you.   Maybe you could rewrite this in form of
something like:

I did X and I expected Y, but instead I see Z.

Are you trying to install the command line standalone program, sqlite.exe?
  You just place it either in your current directory or somewhere in your
windows path.   I assume you're sure you have a 64-bit version of windows
installed.

Your fellow students and instructor should also be able to help I should
hope.

Donald

___
> 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] Help Installing SQLite on a Windows 8.1 PC

2016-07-07 Thread Krista M Whipple
Dear SQLite Users,

 

I am in a Predictive Analytics course which requires the use of SQLite.  I
am not a developer or an analyst and have zero hands on experience with
working with software for databases.

 

I have downloaded the two 64-bit Windows files on my Windows 8.1 PC, but I
cannot get SQLite to install on my PC.

 

Any help or directions would be greatly appreciated,
Krista

 

Krista M. Whipple

Director of Product Development, Kemper P

 

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


[sqlite] Formal specification for sqlite3 file format

2016-07-07 Thread Henry Chan
Dear all,

I'm wondering if there is any "formal" specification for the sqlite3
application format, as in standardized as an ISO/IEC standard, ECMA
standard or RFC?

This is similar to .DOCX being registered as both ISO/IEC 29500
and ECMA-376; JSON being RFC 7159 and ECMA-404, XML being a W3C
specification with various parts as RFC.

Without a "formal" specification, it makes it (unnecessarily) "hard" for
governments to adopt SQLite3's database file as an application format as an
official formats for information exchange.

Such a "formal" specification would simply be a stripped down version of
Section 1 of http://www.sqlite.org/fileformat2.html, where all the reasons
for quirks or definite behavior are stripped and all values could be
described in the database' committed state.


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


[sqlite] sqldiff wrong quoting

2016-07-07 Thread Francesco Frassinelli
Hi,
it looks like sqldiff can't handle special characters like `%`:

$ sqlite3 %.db
SQLite version 3.13.0 2016-05-18 10:57:30
Enter ".help" for usage hints.
sqlite> CREATE TABLE test (`%` REAL);
sqlite>

$ sqldiff %.db %.db
sqldiff: SQL statement error: unrecognized token: """
"SELECT B.rowid, 1, -- changed row
   A.""
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Question about C# with SQLite

2016-07-07 Thread Chris Locke
Possible solution from StackOverflow:
Try setting the Build Action property of the source DLLs to None

On Tue, Jul 5, 2016 at 1:18 PM, Shouwei Li  wrote:

> Hi, guys,
>
> Thank you very much for your reply.
>
> Just make a conclusion, I followed the solution provided in this link, and
> my program could be run on any PC now.
> https://rashimuddin.wordpress.com/tag/sqlite-interop-dll/
>
> But another issue comes out now, I always get this warning when build the
> whole solution.
>
> 1>C:\Program Files
> (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(3506,5):
> warning MSB3178: Assembly 'SQLite\System.Data.SQLite.dll' is incorrectly
> specified as a file.
>
> It not affect the final release program, but I don't know how it comes from
> and how to eliminate it.
>
> Thank you!
>
>
>
> On Tue, Jul 5, 2016 at 9:37 AM, Chris Locke 
> wrote:
>
> > You might need something like Microsofts Process Monitor.
> >
> >
> https://technet.microsoft.com/en-us/sysinternals/processmonitor.aspx?f=255=-2147217396
> >
> > I was getting similar 'red herrings' when deploying my .exe and
> > system.data.sqlite.dll - it was moaning that it couldn't load the DLL.
> > Indeed it couldn't, as it also needed msvcr100.dll, which wasn't on the
> > users machine.  This only came to light when I used the above program and
> > noticed the error produced when it was looking for the file that wasn't
> > there
> >
> >
> > Chris
> >
> > On Tue, Jul 5, 2016 at 4:59 AM, dandl  wrote:
> >
> > > Did you mean: SQLite.Intero.dll or SQLite.Interop.dll?
> > >
> > > Did you put it in the right place?
> > >
> > > Also consider the question of 32 vs 64 bit.
> > >
> > > Did you try Stack Overflow? There are lots of hits over there.
> > >
> > > Regards
> > > David M Bennett FACS
> > >
> > > Andl - A New Database Language - andl.org
> > >
> > >
> > >
> > > > -Original Message-
> > > > From: sqlite-users-boun...@mailinglists.sqlite.org [mailto:
> > sqlite-users-
> > > > boun...@mailinglists.sqlite.org] On Behalf Of J Decker
> > > > Sent: Tuesday, 5 July 2016 12:57 PM
> > > > To: SQLite mailing list 
> > > > Subject: Re: [sqlite] Question about C# with SQLite
> > > >
> > > > if it was built with debug mode; probably the debug runtime doesn't
> > exist
> > > > there.  Otherwise it's because the visual studio runtime required
> isn't
> > > > available.
> > > >
> > > > On Mon, Jul 4, 2016 at 6:52 AM, Shouwei Li  wrote:
> > > >
> > > > > Hi there,
> > > > >
> > > > > I have a project developed with .net 2015 and C#. I use SQLite as
> the
> > > > > server-less database. It works very well in my workstation. But it
> > can
> > > > > not run on other PC. The error indicates:
> > > > >
> > > > > Unable to load DLL "SQLite.Intero.dll": The specified module could
> > not
> > > > > be found.
> > > > >
> > > > > I already attach this dll with my program.
> > > > >
> > > > > I want to ask is there a manual talk about how to deploy a program
> to
> > > > > customer when we use the SQLite database.
> > > > >
> > > > > Thanks for your reading.
> > > > >
> > > > > --
> > > > > Best Regards!
> > > > > Shouwei Li
> > > > > ___
> > > > > 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-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
> >
>
>
>
> --
> Best Regards!
> Shouwei Li
> ___
> 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] SQLite Logo

2016-07-07 Thread Chris Locke
Blimey - arguments over a feather,  However, I want to argue about your "They
look nothing alike" and I would say to a non-feather expert, they are very
similar.  Same orientation (upwards, pointing to the right), white middle,
a nick on the right.  They do look alike ... very alike.


Chris

On Tue, Jul 5, 2016 at 8:56 PM, R Smith  wrote:

>
>
> On 2016/07/05 9:30 PM, Zsbán Ambrus wrote:
>
>> On Fri, Jun 24, 2016 at 2:03 PM, R.A. Nagy  wrote:
>>
>>> I am putting together a commercial training for SQLite. I would like to
>>> use
>>> the SQLite logo - as seen on the website - on the cover of the materials.
>>>
>>
>> SQLite has a logo...
>>
>> wow.  I didn't notice that before.  I just checked the homepage
>> "http://sqlite.org/;, and it shows a feather in the corner that looks
>> basically the same as the Apache logo.  Is there a reason why they're
>> so similar?  I mean, they're both for software, so it can be confusing
>> for people who (unlike me) actually pay attention to logos.
>>
>
> They look nothing alike - I mean apart from the fact they both display a
> feather. Apache uses a multi-coloured pen feather with visible
> downs-feather base (the soft fluffy bit near the bottom of the branching
> section) to represent the typical feathers that might adorn the head-band
> of an Apache Indian chief. No doubt the connotation was made to symbolise
> its relative light-ness in a World of heavy Web servers.
>
> SQLite shows an outer-wing section feather of a smaller bird (no downs,
> shorter with wider blade) in more or less the same orientation as the
> Apache feather, but with no colours (just white on blue background) to
> symbolise very specifically the lightness of the product (I imagine).
>
> They both contain upright feathers, but that's where the similarity ends,
> for if it was the intent of the SQLite creators to mimic the Apache logo,
> they did a very poor job of it!
>
>
> It's like saying the Miami Dolphins has the same Logo as MySQL... :)
>
>
> ___
> 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] builtin functions and strings with embedded nul characters

2016-07-07 Thread James K. Lowden
On Mon, 4 Jul 2016 13:07:18 +0200
R Smith  wrote:

> I think you are missing an important bit in all of this - the strings
> in C is the problem, they think a Null character indicates
> termination. It has nothing to do with how SQL stores data - SQLite
> will store it with all bytes intact, but you typically retrieve or
> set it via some C calls using a C api.. and this is where the problem
> is. 

Dijkstra: On anthropomorphism in science
https://www.cs.utexas.edu/users/EWD/transcriptions/EWD09xx/EWD936.html

C doesn't have strings, and they don't think.  

C has some standard functions that by convention treat byte arrays as
strings.  The convention is to signify EOS with a NUL bytes.  Using
those functions on arrays with non-terminating NULs will probably lead
to undesired results.  

IIUC, there are some string functions in SQLite (including in the SQL
itself) that behave unpredictably if presented with strings that
include embedded NULs.  That needs no defense: it is a defect.  The
DBMS keeps (as it should) explicit lengths for all data.  Treating NUL
specially is only problematic.  Saying their behavior is undefined in
that case at least gives the user fair warning; better would be make it
defined.  

A few people in this thread mentioned something along the lines of
"SQLite data are encoded as UTF-8".  That's not true.  It does not
check that text is correctly or uniformly encoded, nor does it record
what encoding is in force for a given database.  It would be more
accurate to say that SQLite supports 4 Unicode encodings.  

The default encoding is "binary", which is to say unencoded
bytes-as-text.   If the comparison function is memcmp(3), NUL needs no
special treatment.  

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


Re: [sqlite] Extending Porter Tokenizer

2016-07-07 Thread Matthias-Christian Ott
On 2016-07-05 18:11, Abhinav Upadhyay wrote:
> I'm wondering if it is possible to extend the functionality of the
> porter tokenizer. I would like to use the functionality of the Porter
> tokenizer but before stemming the token, I want to decide whether the
> token should be stemmed or not.
> 
> Do I need to copy the Porter tokenizer and modify it to suit my needs
> or there is a better way, to minimize code duplication?

The first argument of the Porter tokenizer is its parent tokenizer. The
Porter tokenizer calls the parent tokenizer's xTokenize function with an
xToken function that wraps the xToken function that was passed to the
xTokenize function of the Porter tokenizer and stems the tokens passed
to it. So create a custom tokenizer that extracts the original xToken
function from the xToken member of its pCtx parameter:

typedef struct PorterContext PorterContext;
struct PorterContext {
  void *pCtx;
  int (*xToken)(void *pCtx, int tflags, const char *pToken, int nToken,
  int iStart, int iEnd);
  char *aBuf;
};

typedef struct CustomTokenizer CustomTokenizer;
struct CustomTokenizer {
  fts5_tokenizer tokenizer;
  Fts5Tokenizer *pTokenizer;
};

typedef struct CustomContext CustomContext;
struct CustomContext {
  void *pCtx;
  int (*xToken)(void *pCtx, int tflags, const char *pToken, int nToken,
  int iStart, int iEnd);
};

int customToken(
  void *pCtx,
  int tflags,
  const char *pToken,
  int nToken,
  int iStart,
  int iEnd
){
  CustomContext *c = (CustomContext*)pCtx;
  PorterContext *p;

  if( stem ){
c->xToken(c->pCtx, tflags, pToken, nToken, iStart, iEnd);
  }else{
p = (PorterContext)c->pCtx;
return p->xToken(p->pCtx, tflags, pToken, nToken, iStart, iEnd);
  }
}

int customTokenize(
  Fts5Tokenizer *pTokenizer,
  void *pCtx,
  int flags,
  const char *pText,
  int nText,
  int (*xToken)(void *, int, const char *, int nToken, int iStart,
  int iEnd)
){
  CustomTokenizer *t = (CustomTokenizer)pTokenizer;
  CustomContext sCtx;
  sCtx.pCtx = pCtx;
  sCtx.xToken = xToken;
  return t->tokenizer.xTokenize(t->pTokenizer, (void*), flags,
  pText, nText, customToken);
}

Note that you are accessing an internal struct and relying on
implementation details and therefore have check whether the struct or
any other relevant implementation details changed with every release.

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


Re: [sqlite] Query Flattener vs. result-set column names

2016-07-07 Thread Clemens Ladisch
Simon Slavin wrote:
> On 7 Jul 2016, at 3:37pm, Josef Kučera  wrote:
>> Imagine a query like "SELECT A.F1, B1.F FROM A JOIN (SELECT F2 AS F FROM B 
>> WHERE F3=0) B1".
>
> your natural JOIN is a little dangerous since it can collapse if you
> change column names or definitions.

A natural join would be written NATURAL JOIN.  This is a cross join.

> It's better to define the connection between the two tables explicitly.
> I would hope to see something more like
>
> SELECT A.F1, B.F FROM A JOIN B ON B.x = A.y

And if the column names are the same (which would always be the case if
the original query actually used a natural join), using USING would be
even simpler:

  SELECT ... FROM A JOIN B USING (SomeID)


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


Re: [sqlite] Query Flattener vs. result-set column names

2016-07-07 Thread Hick Gunter
The returned column names depend on the exact path taken in the query 
optimizer. This may change if the shape of your data changes (analyze is run).

The SQL standard only requires that column references be either unique or 
qualified by table.

-Ursprüngliche Nachricht-
Von: sqlite-users-boun...@mailinglists.sqlite.org 
[mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im Auftrag von Josef 
Kucera
Gesendet: Donnerstag, 07. Juli 2016 17:42
An: SQLite mailing list 
Betreff: Re: [sqlite] Query Flattener vs. result-set column names


- Original Message -
From: "Simon Slavin" 
To: "SQLite mailing list" 
Sent: Thursday, July 07, 2016 5:11 PM
Subject: Re: [sqlite] Query Flattener vs. result-set column names


>
> On 7 Jul 2016, at 3:37pm, Josef Kučera  wrote:
>
>> Imagine a query like "SELECT A.F1, B1.F FROM A JOIN (SELECT F2 AS F FROM
>> B WHERE F3=0) B1". If the query flattener is active the result-set has
>> columns "A.F1" and "B1.F". If it is disabled the result-set columns are
>> "F1" and "F". The "short_column_names" option is set.
>>
>> I thought the optimization used, would not change the result-set column
>> names. Was I wrong?
>
> Yes.  There is no documentation for result-set column names unless you
> specify them using "AS".  They can be anything, and they can change from
> one version of SQLite to another.  Never rely on them unless you're using
> "AS".
>
Yeah, I understand the column names are not defined, but I expected them to
be static for a specific SQLite version, SQL command and database. This is a
wrong assumption then?

> Also, your natural JOIN (sometimes called ANSI JOIN) is a little dangerous
> since it can collapse if you change column names or definitions.  People
> have been complaining about the problem for over a decade.  An example is
> when a program stops working because someone added 'info' columns to both
> tables and the JOIN command is now looking only for cases where they
> match.
>
> It's better to define the connection between the two tables explicitly.  I
> would hope to see something more like
>
> SELECT A.F1, B.F FROM A JOIN B ON B.x = A.y
>
> This lets you define column names all in one place more neatly:
>
> SELECT A.F1 AS F1, B.F AS F1 FROM A JOIN B ON B.x = A.y
>
> rather than having to put some "AS" at the beginning and other "AS" in the
> sub-select.
>
Thank you for the detailed explanation. The natural JOIN was used only to
simplify the sample command, I always explicitly declare the columns used
for the JOIN operation for the same reasons you mentioned.

> Simon.

Joe

___
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
FN 157284 a, HG Wien
Klitschgasse 2-4, A-1130 Vienna, Austria
Tel: +43 1 80100 0
E-Mail: h...@scigames.at

This communication (including any attachments) is intended for the use of the 
intended recipient(s) only and may contain information that is confidential, 
privileged or legally protected. Any unauthorized use or dissemination of this 
communication is strictly prohibited. If you have received this communication 
in error, please immediately notify the sender by return e-mail message and 
delete all copies of the original communication. Thank you for your cooperation.


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


Re: [sqlite] Query Flattener vs. result-set column names

2016-07-07 Thread Josef Kučera


- Original Message - 
From: "Simon Slavin" 

To: "SQLite mailing list" 
Sent: Thursday, July 07, 2016 5:11 PM
Subject: Re: [sqlite] Query Flattener vs. result-set column names




On 7 Jul 2016, at 3:37pm, Josef Kučera  wrote:

Imagine a query like "SELECT A.F1, B1.F FROM A JOIN (SELECT F2 AS F FROM 
B WHERE F3=0) B1". If the query flattener is active the result-set has 
columns "A.F1" and "B1.F". If it is disabled the result-set columns are 
"F1" and "F". The "short_column_names" option is set.


I thought the optimization used, would not change the result-set column 
names. Was I wrong?


Yes.  There is no documentation for result-set column names unless you 
specify them using "AS".  They can be anything, and they can change from 
one version of SQLite to another.  Never rely on them unless you're using 
"AS".


Yeah, I understand the column names are not defined, but I expected them to 
be static for a specific SQLite version, SQL command and database. This is a 
wrong assumption then?


Also, your natural JOIN (sometimes called ANSI JOIN) is a little dangerous 
since it can collapse if you change column names or definitions.  People 
have been complaining about the problem for over a decade.  An example is 
when a program stops working because someone added 'info' columns to both 
tables and the JOIN command is now looking only for cases where they 
match.


It's better to define the connection between the two tables explicitly.  I 
would hope to see something more like


SELECT A.F1, B.F FROM A JOIN B ON B.x = A.y

This lets you define column names all in one place more neatly:

SELECT A.F1 AS F1, B.F AS F1 FROM A JOIN B ON B.x = A.y

rather than having to put some "AS" at the beginning and other "AS" in the 
sub-select.


Thank you for the detailed explanation. The natural JOIN was used only to 
simplify the sample command, I always explicitly declare the columns used 
for the JOIN operation for the same reasons you mentioned.



Simon.


Joe

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


Re: [sqlite] Query Flattener vs. result-set column names

2016-07-07 Thread Simon Slavin

On 7 Jul 2016, at 3:37pm, Josef Kučera  wrote:

> Imagine a query like "SELECT A.F1, B1.F FROM A JOIN (SELECT F2 AS F FROM B 
> WHERE F3=0) B1". If the query flattener is active the result-set has columns 
> "A.F1" and "B1.F". If it is disabled the result-set columns are "F1" and "F". 
> The "short_column_names" option is set.
> 
> I thought the optimization used, would not change the result-set column 
> names. Was I wrong?

Yes.  There is no documentation for result-set column names unless you specify 
them using "AS".  They can be anything, and they can change from one version of 
SQLite to another.  Never rely on them unless you're using "AS".

Also, your natural JOIN (sometimes called ANSI JOIN) is a little dangerous 
since it can collapse if you change column names or definitions.  People have 
been complaining about the problem for over a decade.  An example is when a 
program stops working because someone added 'info' columns to both tables and 
the JOIN command is now looking only for cases where they match.

It's better to define the connection between the two tables explicitly.  I 
would hope to see something more like

SELECT A.F1, B.F FROM A JOIN B ON B.x = A.y

This lets you define column names all in one place more neatly:

SELECT A.F1 AS F1, B.F AS F1 FROM A JOIN B ON B.x = A.y

rather than having to put some "AS" at the beginning and other "AS" in the 
sub-select.

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


[sqlite] Query Flattener vs. result-set column names

2016-07-07 Thread Josef Kučera
Hello,
today I have discovered a strange side-effect of a query flattener.

Imagine a query like "SELECT A.F1, B1.F FROM A JOIN (SELECT F2 AS F FROM B 
WHERE F3=0) B1". If the query flattener is active the result-set has columns 
"A.F1" and "B1.F". If it is disabled the result-set columns are "F1" and "F". 
The "short_column_names" option is set.

I thought the optimization used, would not change the result-set column names. 
Was I wrong?

Best regards
Joe

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