Re: [sqlite] ANN: SQLite 3.6.16.C#

2009-08-02 Thread Neville Franks
Hi Noah,
A name suggestion:
"SharpLightSQL" - SLSQL or just SLS.

Sunday, August 2, 2009, 10:57:56 PM, you wrote:

NH> Richard sent me a gentle reminder that read in part:

NH> 
NH> Please also note that the SQLite source code is in the public domain, but
NH> the "SQLite" name is not.  SQLite is a registered trade mark.  If I don't
NH> defend the trademark, then I could lose it.  So, I really do need to insist
NH> that you not use the name "SQLite" for your product.
NH> 


NH> This is an excellent reminder, and until this is done, I've removed access
NH> to the source code and will terminate this google code project.  I'll post
NH> an announcement in the future when the new project is ready.

NH> Also, if anyone has an ideal about what to call it ...
NH> Regards,

---
Best regards,
  Neville Franks, http://www.surfulater.com http://blog.surfulater.com
 

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


Re: [sqlite] CREATE TABLE AS SELECT * FROM changes columndefinition --bug or feature?

2009-08-02 Thread Igor Tandetnik
P Kishor wrote:
> On Sun, Aug 2, 2009 at 10:39 PM, Igor
> Tandetnik wrote:
>> You don't make a copy of a table - you make a copy of the resultset
>> of a SELECT statement. Columns in said resultset don't carry
>> attributes like DEFAULT, even though columns in the underlying table
>> may.
>
> Hmmm... now that you say so, I am reminded of this topic a short while
> ago. Makes sense what you say Igor. However, if the "copy of the
> resultset of a SELECT statement" was smart enough to bring over 'desc
> TEXT', why was it not quite smart enough to bring over the 'PRIMARY
> KEY' part of 'id' or the 'DEFAULT 0' part of 'num'?

'desc' and 'TEXT' are in fact properties of the resultset - see 
sqlite3_column_name, sqlite3_column_decltype

Igor Tandetnik 



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


Re: [sqlite] CREATE TABLE AS SELECT * FROM changes column definition --bug or feature?

2009-08-02 Thread P Kishor
On Sun, Aug 2, 2009 at 10:39 PM, Igor Tandetnik wrote:
> P Kishor wrote:
>> SQLite version 3.6.11
>> Enter ".help" for instructions
>> Enter SQL statements terminated with a ";"
>> sqlite> CREATE TABLE foo (id INTEGER PRIMARY KEY, desc TEXT, num
>> INTEGER DEFAULT 0);
>> sqlite> INSERT INTO foo (desc) VALUES ('foo');
>> sqlite> INSERT INTO foo (desc) VALUES ('bar');
>> sqlite> INSERT INTO foo (desc) VALUES ('baz');
>> sqlite> SELECT * FROM foo;
>> id          desc        num
>> --  --  --
>> 1           foo         0
>> 2           bar         0
>> 3           baz         0
>> sqlite> CREATE TABLE bar AS SELECT * FROM foo;
>> sqlite> .s
>> CREATE TABLE bar(id INTEGER,"desc" TEXT,num INTEGER);
>> CREATE TABLE foo (id INTEGER PRIMARY KEY, desc TEXT, num INTEGER
>> DEFAULT 0);
>>
>>
>> Why did the definition of the column ‘num’ change? Where did the
>> ‘DEFAULT 0’ part go in the definition of ‘num’?
>
> You don't make a copy of a table - you make a copy of the resultset of a
> SELECT statement. Columns in said resultset don't carry attributes like
> DEFAULT, even though columns in the underlying table may. Consider:
>
> create table bar as
> select id + 1, desc || 'xyz', num * id from foo;
>
> What do you expect the definition of bar to be?
>

Hmmm... now that you say so, I am reminded of this topic a short while
ago. Makes sense what you say Igor. However, if the "copy of the
resultset of a SELECT statement" was smart enough to bring over 'desc
TEXT', why was it not quite smart enough to bring over the 'PRIMARY
KEY' part of 'id' or the 'DEFAULT 0' part of 'num'?

I wonder if there is any technical reason for not doing that? After
all, the information is in the schema.

I guess 'CREATE TABLE newtable AS SELECT * FROM oldtable' is not a
recommended way of duping a table. The most reliable and accurate way
well might be to dump the old table, recreate the new table, then
import the data from the old table. Kinda pain if the table definition
is highly complicated.





-- 
Puneet Kishor http://www.punkish.org
Carbon Model http://carbonmodel.org
Charter Member, Open Source Geospatial Foundation http://www.osgeo.org
Science Commons Fellow, http://sciencecommons.org/about/whoweare/kishor
Nelson Institute, UW-Madison http://www.nelson.wisc.edu
---
Assertions are politics; backing up assertions with evidence is science
===
Sent from Madison, WI, United States
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] CREATE TABLE AS SELECT * FROM changes column definition --bug or feature?

2009-08-02 Thread Igor Tandetnik
P Kishor wrote:
> SQLite version 3.6.11
> Enter ".help" for instructions
> Enter SQL statements terminated with a ";"
> sqlite> CREATE TABLE foo (id INTEGER PRIMARY KEY, desc TEXT, num
> INTEGER DEFAULT 0);
> sqlite> INSERT INTO foo (desc) VALUES ('foo');
> sqlite> INSERT INTO foo (desc) VALUES ('bar');
> sqlite> INSERT INTO foo (desc) VALUES ('baz');
> sqlite> SELECT * FROM foo;
> id  descnum
> --  --  --
> 1   foo 0
> 2   bar 0
> 3   baz 0
> sqlite> CREATE TABLE bar AS SELECT * FROM foo;
> sqlite> .s
> CREATE TABLE bar(id INTEGER,"desc" TEXT,num INTEGER);
> CREATE TABLE foo (id INTEGER PRIMARY KEY, desc TEXT, num INTEGER
> DEFAULT 0);
>
>
> Why did the definition of the column ‘num’ change? Where did the
> ‘DEFAULT 0’ part go in the definition of ‘num’?

You don't make a copy of a table - you make a copy of the resultset of a 
SELECT statement. Columns in said resultset don't carry attributes like 
DEFAULT, even though columns in the underlying table may. Consider:

create table bar as
select id + 1, desc || 'xyz', num * id from foo;

What do you expect the definition of bar to be?

Igor Tandetnik 



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


Re: [sqlite] ANN: SQLite 3.6.16.C#

2009-08-02 Thread Darren Duncan
P Kishor wrote:
> On Sun, Aug 2, 2009 at 7:57 AM, Noah Hart wrote:
>> Richard sent me a gentle reminder that read in part:
>>
>> 
>> Please also note that the SQLite source code is in the public domain, but
>> the "SQLite" name is not.  SQLite is a registered trade mark.  If I don't
>> defend the trademark, then I could lose it.  So, I really do need to insist
>> that you not use the name "SQLite" for your product.
>> 
>>
>> This is an excellent reminder, and until this is done, I've removed access
>> to the source code and will terminate this google code project.  I'll post
>> an announcement in the future when the new project is ready.

That's great.

> A very valid point from DRH re. protecting the sanctity of SQLite, the
> (tm), but the horse may have already left the stable. A quick search
> on macupdate.com reveals the following products with ‘SQLite’ in their
> name (with the indicated capitalization) --
> 
> MesaSQLite
> SQLite Migrator
> SQLite Diff
> SQLiteManager X
> 
> and
> 
> SqliteQuery
> 
> I am sure there are more on Win and *nix platforms.

Even if other projects exist, they can also still be requested to change their 
names too if DRH considers there might be confusion in people as to whether 
they 
are official works of DRH.  Or barring that, the other projects can be asked to 
prominently state anywhere one may encounter them that they are not official 
works of DRH nor (if true) sanctioned by DRH.

> One question might be -- if one chooses a name that does not have
> ‘SQLite’ or any variations thereof in it (from what I can see, Noah
> called the product ‘sqlitecs’), then how does one indicate that the
> product is built on or inspired by SQLite?

Use the *description* text of the product to indicate its relation to SQLite.

> Also, is SQLite
> trademarked, or sqlite or both?

Trademark word-marks are case-insensitive (and usually are formally written 
fully in uppercase), so the answer is "all of the above".

> I thought Tito Ciuro’s now-in-limbo QuickLite was very cleverly named,
> but it is generally gonna be difficult to avoid mention of SQLite in
> the name.

Its very easy.  Just make up some word that *doesn't* resemble "SQLite" (aside, 
if you want, the "SQL" part) and use the description to indicate similarity.

>> Also, if anyone has an ideal about what to call it ...
>> Regards,
>>
>> Noah Hart

I suggest just putting together some combination of letters that hasn't been 
used yet and reads nicely, and use that.  It doesn't have to be descriptive, 
just unique and brandable.

Make your own brand identity and just document the relationship to SQLite for 
credit purposes.  Searches for SQLite would still turn up yours due to the 
documentation.

That's what I did when I made up the word MULDIS (MULtiverse of DIScourse) for 
my DBMS project, and it's one of the best strategic decisions I've made.

Something else I did, and maybe DRH can do something similar if he hasn't 
already, is write up an easy to find policy page about the best ways to use or 
not use the word SQLITE (any capitalization) so to work with his trademark.

See http://www.muldis.com/trademark_policy.html for my full version for 
example, 
and http://search.cpan.org/dist/Muldis-D/lib/Muldis/D.pm#TRADEMARK_POLICY for 
an 
example abbreviated version accompanying a branded product.

-- Darren Duncan

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


[sqlite] CREATE TABLE AS SELECT * FROM changes column definition -- bug or feature?

2009-08-02 Thread P Kishor
SQLite version 3.6.11
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> CREATE TABLE foo (id INTEGER PRIMARY KEY, desc TEXT, num
INTEGER DEFAULT 0);
sqlite> INSERT INTO foo (desc) VALUES ('foo');
sqlite> INSERT INTO foo (desc) VALUES ('bar');
sqlite> INSERT INTO foo (desc) VALUES ('baz');
sqlite> SELECT * FROM foo;
id  descnum
--  --  --
1   foo 0
2   bar 0
3   baz 0
sqlite> CREATE TABLE bar AS SELECT * FROM foo;
sqlite> .s
CREATE TABLE bar(id INTEGER,"desc" TEXT,num INTEGER);
CREATE TABLE foo (id INTEGER PRIMARY KEY, desc TEXT, num INTEGER DEFAULT 0);


Why did the definition of the column ‘num’ change? Where did the
‘DEFAULT 0’ part go in the definition of ‘num’?

-- 
Puneet Kishor http://www.punkish.org
Carbon Model http://carbonmodel.org
Charter Member, Open Source Geospatial Foundation http://www.osgeo.org
Science Commons Fellow, http://sciencecommons.org/about/whoweare/kishor
Nelson Institute, UW-Madison http://www.nelson.wisc.edu
---
Assertions are politics; backing up assertions with evidence is science
===
Sent from Madison, WI, United States
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] ANN: SQLite 3.6.16.C#

2009-08-02 Thread Kosenko Max


John Stanton-3 wrote:
> 
> Maybe the author could explain the reason for C# translation.  Surely a 
> better approach if the JIT is required would be to use something like 
> gcc and change the code generator to the C# metacode.  Such a product 
> may already exist.
> 
> A translated program is rev locked.

He has already answered that this was done for educational purposes.
I don't believe there is an easy way exists with changing code generator,
but automatic translation of some parts can be very helpful. Meanwhile -
what is already done can be kept on par with native version updates by
checking commits and making similar changes.

-
Best Regards.
Max Kosenko.
-- 
View this message in context: 
http://www.nabble.com/ANN%3A--SQLite-3.6.16.C--tp24764742p24783123.html
Sent from the SQLite mailing list archive at Nabble.com.

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


Re: [sqlite] ANN: SQLite 3.6.16.C#

2009-08-02 Thread John Stanton
Maybe the author could explain the reason for C# translation.  Surely a 
better approach if the JIT is required would be to use something like 
gcc and change the code generator to the C# metacode.  Such a product 
may already exist.

A translated program is rev locked.

Kosenko Max wrote:
> Seems like I've missed something...
> 
> Well, if there would be a team dedicated to supporting managed
> implementation of SQLite which can be at any time quickly updated to reflect
> all changes of SQLite native - anyone can always transfer such requests to
> that team. Same happens i.e. with SQLite.NET which might look like managed
> implementation of SQLite, but it's just embedding native part in .NET DLL
> which in turn implements full scale ADO.NET support.
> 
> Isn't SQLite project in general will benefit from having line by line
> (except critical paths requiring another implementation) managed version of
> product? It looks for me like a contribution and not as a headache.
> 
> I can say that my inspection shows that this is pure managed C# with just 10
> P/Invokes those can be easily eliminated. Some inefficiencies exists and
> they also could be removed later. Silverlight, Moonlight, Mono can benefit
> from managed SQLite. But I think that managed version can also give an
> ability to be more flexible in some tryouts of further improvement and
> optimization of SQLite itself.
> 
> Max
> 
> Tim Anderson-2 wrote:
>>> I don't know why he insists on that (he actually can answer for himself
>>> here) while there are a lot of SQLite based projects with that name
>>> usage.
>> Well, he's already answered it: he doesn't want to get support requests
>> for the port.
>>
>> I think I'm right in saying that most of the SQLite-named projects out
>> there are wrappers rather than ports, albeit some of them link the code
>> into their own executables. Are there any ports to other languages called
>> SQLite?
>>
>> It may also be a kind of compliment - that he thinks the port could prove
>> popular. If it is pure C# with no interop, I agree - would be very useful
>> for Silverlight, for example.
>>
>> Tim
>>
> 
> 
> -
> Best Regards.
> Max Kosenko.

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


Re: [sqlite] ANN: SQLite 3.6.16.C#

2009-08-02 Thread Kosenko Max


Noah Hart wrote:
> The license is the same as SQLite, I'm waiting on google to change the
> project to PD since that is not one of the canned choices.

Thank you very much.

Can't disagree with Miguel that this is "A godsend gift to developers".
Keep us informed about name change (in case Dr. won't change his mind ;).

-
Best Regards.
Max Kosenko.
-- 
View this message in context: 
http://www.nabble.com/ANN%3A--SQLite-3.6.16.C--tp24764742p24782845.html
Sent from the SQLite mailing list archive at Nabble.com.

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


Re: [sqlite] ANN: SQLite 3.6.16.C#

2009-08-02 Thread Noah Hart

And in the Window's there are ...

For example:

System.Data.SQLite
An open source ADO.NET provider for the SQLite database engine
http://sqlite.phxsoftware.com/

http://code.google.com/p/sqlite-ng/
sqlite-ng A fork of SQLite with more community involvement

SQLite-ng is a fork of SQLite with the goal of providing 100% API and ABI
compatibility.


sqlite3pp
SQLite3++ - C++ wrapper of SQLite3 API
It makes SQLite3 API more friendly to C++ users. It supports almost all of
SQLite3 features using C++ classes such as database, command, query, and
transaction. The query class supports iterator concept for fetching records.


sqlitevb
SQLiteVB: public functions modified to attend VB standards of compatibility


Noah


On Sun, Aug 2, 2009 at 7:57 AM, Noah Hart wrote:
>
> Richard sent me a gentle reminder that read in part:
>
> 
> Please also note that the SQLite source code is in the public domain, but
> the "SQLite" name is not.  SQLite is a registered trade mark.  If I don't
> defend the trademark, then I could lose it.  So, I really do need to
> insist
> that you not use the name "SQLite" for your product.
> 
>
>
> This is an excellent reminder, and until this is done, I've removed access
> to the source code and will terminate this google code project.  I'll post
> an announcement in the future when the new project is ready.


A very valid point from DRH re. protecting the sanctity of SQLite, the
(tm), but the horse may have already left the stable. A quick search
on macupdate.com reveals the following products with ‘SQLite’ in their
name (with the indicated capitalization) --

-- 
View this message in context: 
http://www.nabble.com/ANN%3A--SQLite-3.6.16.C--tp24764742p24782171.html
Sent from the SQLite mailing list archive at Nabble.com.

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


Re: [sqlite] ANN: SQLite 3.6.16.C#

2009-08-02 Thread Noah Hart

The license is the same as SQLite, I'm waiting on google to change the
project to PD since that is not one of the canned choices.

Noah

It's a pity news. I hoped Dr. can think about even somehow supporting your
project.

I don't know why he insists on that (he actually can answer for himself
here) while there are a lot of SQLite based projects with that name usage.
May be that's because of your license?

Max.

-- 
View this message in context: 
http://www.nabble.com/ANN%3A--SQLite-3.6.16.C--tp24764742p24782158.html
Sent from the SQLite mailing list archive at Nabble.com.

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


Re: [sqlite] ANN: SQLite 3.6.16.C#

2009-08-02 Thread Konrad J Hambrick


Thanks Jim !

-- kjh


Jim Showalter wrote:
> Yes, C# supports native calls. You just call pinvoke.
> 
> But a pure C# implementation allows it to run in Silverlight and other 
> C# applications where native calls are not allowed.
> 
> http://sqlite.phxsoftware.com/forums/t/1642.aspx
> 
> - Original Message - From: "Konrad J Hambrick" 
> To: "General Discussion of SQLite Database" 
> Sent: Sunday, August 02, 2009 12:19 PM
> Subject: Re: [sqlite] ANN: SQLite 3.6.16.C#
> 
> 
>>
>> Noah --
>>
>> This is a wonderful accomplishment !
>>
>> However, I have a question ...
>>
>> Doesn't C# support native function calls ?
>>
>> If so, other than scratching an itch, what does a native port to C# do ?
>>
>> Thanks.
>>
>> -- kjh
>>
>> Noah Hart wrote:
>>> Richard sent me a gentle reminder that read in part:
>>>
>>> 
>>> Please also note that the SQLite source code is in the public domain, 
>>> but
>>> the "SQLite" name is not.  SQLite is a registered trade mark.  If I 
>>> don't
>>> defend the trademark, then I could lose it.  So, I really do need to 
>>> insist
>>> that you not use the name "SQLite" for your product.
>>> 
>>>
>>>
>>> This is an excellent reminder, and until this is done, I've removed 
>>> access
>>> to the source code and will terminate this google code project. I'll 
>>> post
>>> an announcement in the future when the new project is ready.
>>>
>>> Also, if anyone has an ideal about what to call it ...
>>> Regards,
>>>
>>> Noah Hart
>>>
>>>
>>>
>>> Noah Hart wrote:
 I am pleased to announce that the C# port is done to the point where
 others can look at it.

 The project is located at http://code.google.com/p/sqlitecs

 Enjoy,

 Noah Hart

>>>
>> ___
>> 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


Re: [sqlite] ANN: SQLite 3.6.16.C#

2009-08-02 Thread Jim Showalter
Yes, C# supports native calls. You just call pinvoke.

But a pure C# implementation allows it to run in Silverlight and other 
C# applications where native calls are not allowed.

http://sqlite.phxsoftware.com/forums/t/1642.aspx

- Original Message - 
From: "Konrad J Hambrick" 
To: "General Discussion of SQLite Database" 
Sent: Sunday, August 02, 2009 12:19 PM
Subject: Re: [sqlite] ANN: SQLite 3.6.16.C#


>
> Noah --
>
> This is a wonderful accomplishment !
>
> However, I have a question ...
>
> Doesn't C# support native function calls ?
>
> If so, other than scratching an itch, what does a native port to C# 
> do ?
>
> Thanks.
>
> -- kjh
>
> Noah Hart wrote:
>> Richard sent me a gentle reminder that read in part:
>>
>> 
>> Please also note that the SQLite source code is in the public 
>> domain, but
>> the "SQLite" name is not.  SQLite is a registered trade mark.  If I 
>> don't
>> defend the trademark, then I could lose it.  So, I really do need 
>> to insist
>> that you not use the name "SQLite" for your product.
>> 
>>
>>
>> This is an excellent reminder, and until this is done, I've removed 
>> access
>> to the source code and will terminate this google code project. 
>> I'll post
>> an announcement in the future when the new project is ready.
>>
>> Also, if anyone has an ideal about what to call it ...
>> Regards,
>>
>> Noah Hart
>>
>>
>>
>> Noah Hart wrote:
>>> I am pleased to announce that the C# port is done to the point 
>>> where
>>> others can look at it.
>>>
>>> The project is located at http://code.google.com/p/sqlitecs
>>>
>>> Enjoy,
>>>
>>> Noah Hart
>>>
>>
> ___
> 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


Re: [sqlite] ANN: SQLite 3.6.16.C#

2009-08-02 Thread Konrad J Hambrick

Noah --

This is a wonderful accomplishment !

However, I have a question ...

Doesn't C# support native function calls ?

If so, other than scratching an itch, what does a native port to C# do ?

Thanks.

-- kjh

Noah Hart wrote:
> Richard sent me a gentle reminder that read in part:
> 
> 
> Please also note that the SQLite source code is in the public domain, but
> the "SQLite" name is not.  SQLite is a registered trade mark.  If I don't
> defend the trademark, then I could lose it.  So, I really do need to insist
> that you not use the name "SQLite" for your product.
> 
> 
> 
> This is an excellent reminder, and until this is done, I've removed access 
> to the source code and will terminate this google code project.  I'll post
> an announcement in the future when the new project is ready.
> 
> Also, if anyone has an ideal about what to call it ...
> Regards,
> 
> Noah Hart   
> 
> 
> 
> Noah Hart wrote:
>> I am pleased to announce that the C# port is done to the point where
>> others can look at it.
>>
>> The project is located at http://code.google.com/p/sqlitecs
>>
>> Enjoy,
>>
>> Noah Hart
>>
> 
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] ANN: SQLite 3.6.16.C#

2009-08-02 Thread Kosenko Max

Seems like I've missed something...

Well, if there would be a team dedicated to supporting managed
implementation of SQLite which can be at any time quickly updated to reflect
all changes of SQLite native - anyone can always transfer such requests to
that team. Same happens i.e. with SQLite.NET which might look like managed
implementation of SQLite, but it's just embedding native part in .NET DLL
which in turn implements full scale ADO.NET support.

Isn't SQLite project in general will benefit from having line by line
(except critical paths requiring another implementation) managed version of
product? It looks for me like a contribution and not as a headache.

I can say that my inspection shows that this is pure managed C# with just 10
P/Invokes those can be easily eliminated. Some inefficiencies exists and
they also could be removed later. Silverlight, Moonlight, Mono can benefit
from managed SQLite. But I think that managed version can also give an
ability to be more flexible in some tryouts of further improvement and
optimization of SQLite itself.

Max

Tim Anderson-2 wrote:
> 
>> I don't know why he insists on that (he actually can answer for himself
>> here) while there are a lot of SQLite based projects with that name
>> usage.
> 
> Well, he's already answered it: he doesn't want to get support requests
> for the port.
> 
> I think I'm right in saying that most of the SQLite-named projects out
> there are wrappers rather than ports, albeit some of them link the code
> into their own executables. Are there any ports to other languages called
> SQLite?
> 
> It may also be a kind of compliment - that he thinks the port could prove
> popular. If it is pure C# with no interop, I agree - would be very useful
> for Silverlight, for example.
> 
> Tim
> 


-
Best Regards.
Max Kosenko.
-- 
View this message in context: 
http://www.nabble.com/ANN%3A--SQLite-3.6.16.C--tp24764742p24781026.html
Sent from the SQLite mailing list archive at Nabble.com.

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


Re: [sqlite] ANN: SQLite 3.6.16.C#

2009-08-02 Thread Tim Anderson
> -Original Message-
> From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-
> boun...@sqlite.org] On Behalf Of Kosenko Max
> Sent: 02 August 2009 19:40
> To: sqlite-users@sqlite.org
> Subject: Re: [sqlite] ANN: SQLite 3.6.16.C#

> I don't know why he insists on that (he actually can answer for himself
> here) while there are a lot of SQLite based projects with that name
> usage.

Well, he's already answered it: he doesn't want to get support requests for the 
port.

I think I'm right in saying that most of the SQLite-named projects out there 
are wrappers rather than ports, albeit some of them link the code into their 
own executables. Are there any ports to other languages called SQLite?

It may also be a kind of compliment - that he thinks the port could prove 
popular. If it is pure C# with no interop, I agree - would be very useful for 
Silverlight, for example.

Tim

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


Re: [sqlite] ANN: SQLite 3.6.16.C#

2009-08-02 Thread Jim Showalter
Max's point is that JITs automatically compile down to native code, 
thus a screwdriver is turned into a monkey wrench, therefore you only 
need the screwdriver.

There are other reasons besides native vs. VM why C#/Java would be 
slower than C. For example, C doesn't have the overhead of virtual 
dispatch. And JIT'ing value-type generics in C# can bloat the code.

I *like* managed languages--arguing against having the runtime take 
care of memory allocation reminds me of programmers arguing 40 years 
ago that hand-written assembly was superior to high-level compilers. 
That may have been true initially, and may still be true for 
specialized cases (video drivers?), but in general it's poppycock.

- Original Message - 
From: "Fred Williams" 
To: "General Discussion of SQLite Database" 
Sent: Sunday, August 02, 2009 11:23 AM
Subject: Re: [sqlite] ANN: SQLite 3.6.16.C#


>I have at least a screwdriver and monkey wrench to go with my hammer 
>in my
> computer software tool bag.  Observing the fastener at hand allows 
> me to
> pick the proper tool.  Then if that doesn't work, there's always the 
> hammer.
>
> -Original Message-
> From: sqlite-users-boun...@sqlite.org
> [mailto:sqlite-users-boun...@sqlite.org]on Behalf Of Kosenko Max
> Sent: Sunday, August 02, 2009 6:32 AM
> To: sqlite-users@sqlite.org
> Subject: Re: [sqlite] ANN: SQLite 3.6.16.C#
>
>
>
> I don't know why you have decided that C# or Java isn't competitive 
> to
> native
> compiled code.
> After JIT there is no VM between Java/.NET and OS.
>
> While C has better compiler than C# it still don't have JIT engine 
> that can
> optimize your code for specific hardware you're running on right 
> now. Or it
> can recompile code based on statistics. Options unavailable to 
> native code.
> And after all having managed implementation gives better control on 
> code,
> simpler code and so on. So in reality there should be strong reason 
> for NOT
> using managed implementations for whatever. But it's only rising 
> now...
>
>
> Jim Showalter-4 wrote:
>>
>> Could we not disparage different OSs and languages?
>>
>> A fair comparison of performance isn't between a C and C#
>> implementation of SQLite, but between a C# and Java implementation 
>> of
>> SQLite. Both C# and Java are managed languages that run atop a VM 
>> that
>> runs atop an OS. C is down on the metal. I would expect the C 
>> version
>> to be faster.
>>
>> I don't know the background of why this programmer did a port 
>> directly
>> to C# instead of binding C# to the existing C library, but I assume 
>> he
>> had his reasons.
>>
>> - Original Message -
>> From: "Fred Williams" 
>> To: "General Discussion of SQLite Database" 
>> 
>> Sent: Saturday, August 01, 2009 6:08 AM
>> Subject: Re: [sqlite] ANN: SQLite 3.6.16.C#
>>
>>
>>>
>>> Hummm... Guess there is a reason there are no implementations of 
>>> C#
>>> external
>>> to the Mickeysoft world :-)
>>>
>>> Guess if I had a lot of time to kill I could port it to Delphi...
>>>
>>> BTW, what's the memory footprint?
>>>
>>> Fred
>>>
>>> -Original Message-
>>> From: sqlite-users-boun...@sqlite.org
>>> [mailto:sqlite-users-boun...@sqlite.org]on Behalf Of Kosenko Max
>>> Sent: Saturday, August 01, 2009 6:22 AM
>>> To: sqlite-users@sqlite.org
>>> Subject: Re: [sqlite] ANN: SQLite 3.6.16.C#
>>>
>>>
>>>
>>> Seems like I've misunderstood your performance results. And they 
>>> are
>>> 3-5times
>>> slower than original...
>>>
>>> -
>>> Best Regards.
>>> Max Kosenko.
>>> --
>>> View this message in context:
>>> http://www.nabble.com/ANN%3A--SQLite-3.6.16.C--tp24764742p24768252.html
>>> Sent from the SQLite mailing list archive at Nabble.com.
>>>
>>> ___
>>> 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-users mailing list
>> sqlite-users@sqlite.org
>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>>
>>
>
>
> -
> Best Regards.
> Max Kosenko.
> --
> View this message in context:
> http://www.nabble.com/ANN%3A--SQLite-3.6.16.C--tp24764742p24777007.html
> Sent from the SQLite mailing list archive at Nabble.com.
>
> ___
> 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-users mailing list
sqlite-users@sqlite.org

Re: [sqlite] ANN: SQLite 3.6.16.C#

2009-08-02 Thread Kosenko Max

It's a pity news. I hoped Dr. can think about even somehow supporting your
project.

I don't know why he insists on that (he actually can answer for himself
here) while there are a lot of SQLite based projects with that name usage.
May be that's because of your license?

Max.

Noah Hart wrote:
> 
> Richard sent me a gentle reminder that read in part:
> 
> 
> Please also note that the SQLite source code is in the public domain, but
> the "SQLite" name is not.  SQLite is a registered trade mark.  If I don't
> defend the trademark, then I could lose it.  So, I really do need to
> insist that you not use the name "SQLite" for your product.
> 
> 
> 
> This is an excellent reminder, and until this is done, I've removed access 
> to the source code and will terminate this google code project.  I'll post
> an announcement in the future when the new project is ready.
> 
> Also, if anyone has an ideal about what to call it ...
> 


-
Best Regards.
Max Kosenko.
-- 
View this message in context: 
http://www.nabble.com/ANN%3A--SQLite-3.6.16.C--tp24764742p24780720.html
Sent from the SQLite mailing list archive at Nabble.com.

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


Re: [sqlite] ANN: SQLite 3.6.16.C#

2009-08-02 Thread Fred Williams
Thank you for your understanding.  And best of luck with XXLite?

I know you have a large captive audience out there.  It is the only reason I
swallow my pride and admit knowledge of the most pervasive OS currently on
the planet.  Not the "best" technically, but best "marketed."

Fred

-Original Message-
From: sqlite-users-boun...@sqlite.org
[mailto:sqlite-users-boun...@sqlite.org]on Behalf Of Noah Hart
Sent: Sunday, August 02, 2009 7:58 AM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] ANN: SQLite 3.6.16.C#



Richard sent me a gentle reminder that read in part:


Please also note that the SQLite source code is in the public domain, but
the "SQLite" name is not.  SQLite is a registered trade mark.  If I don't
defend the trademark, then I could lose it.  So, I really do need to insist
that you not use the name "SQLite" for your product.



This is an excellent reminder, and until this is done, I've removed access
to the source code and will terminate this google code project.  I'll post
an announcement in the future when the new project is ready.

Also, if anyone has an ideal about what to call it ...
Regards,

Noah Hart



Noah Hart wrote:
>
> I am pleased to announce that the C# port is done to the point where
> others can look at it.
>
> The project is located at http://code.google.com/p/sqlitecs
>
> Enjoy,
>
> Noah Hart
>

--
View this message in context:
http://www.nabble.com/ANN%3A--SQLite-3.6.16.C--tp24764742p24777619.html
Sent from the SQLite mailing list archive at Nabble.com.

___
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


Re: [sqlite] ANN: SQLite 3.6.16.C#

2009-08-02 Thread Fred Williams
I have at least a screwdriver and monkey wrench to go with my hammer in my
computer software tool bag.  Observing the fastener at hand allows me to
pick the proper tool.  Then if that doesn't work, there's always the hammer.

-Original Message-
From: sqlite-users-boun...@sqlite.org
[mailto:sqlite-users-boun...@sqlite.org]on Behalf Of Kosenko Max
Sent: Sunday, August 02, 2009 6:32 AM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] ANN: SQLite 3.6.16.C#



I don't know why you have decided that C# or Java isn't competitive to
native
compiled code.
After JIT there is no VM between Java/.NET and OS.

While C has better compiler than C# it still don't have JIT engine that can
optimize your code for specific hardware you're running on right now. Or it
can recompile code based on statistics. Options unavailable to native code.
And after all having managed implementation gives better control on code,
simpler code and so on. So in reality there should be strong reason for NOT
using managed implementations for whatever. But it's only rising now...


Jim Showalter-4 wrote:
>
> Could we not disparage different OSs and languages?
>
> A fair comparison of performance isn't between a C and C#
> implementation of SQLite, but between a C# and Java implementation of
> SQLite. Both C# and Java are managed languages that run atop a VM that
> runs atop an OS. C is down on the metal. I would expect the C version
> to be faster.
>
> I don't know the background of why this programmer did a port directly
> to C# instead of binding C# to the existing C library, but I assume he
> had his reasons.
>
> - Original Message -
> From: "Fred Williams" 
> To: "General Discussion of SQLite Database" 
> Sent: Saturday, August 01, 2009 6:08 AM
> Subject: Re: [sqlite] ANN: SQLite 3.6.16.C#
>
>
>>
>> Hummm... Guess there is a reason there are no implementations of C#
>> external
>> to the Mickeysoft world :-)
>>
>> Guess if I had a lot of time to kill I could port it to Delphi...
>>
>> BTW, what's the memory footprint?
>>
>> Fred
>>
>> -Original Message-
>> From: sqlite-users-boun...@sqlite.org
>> [mailto:sqlite-users-boun...@sqlite.org]on Behalf Of Kosenko Max
>> Sent: Saturday, August 01, 2009 6:22 AM
>> To: sqlite-users@sqlite.org
>> Subject: Re: [sqlite] ANN: SQLite 3.6.16.C#
>>
>>
>>
>> Seems like I've misunderstood your performance results. And they are
>> 3-5times
>> slower than original...
>>
>> -
>> Best Regards.
>> Max Kosenko.
>> --
>> View this message in context:
>> http://www.nabble.com/ANN%3A--SQLite-3.6.16.C--tp24764742p24768252.html
>> Sent from the SQLite mailing list archive at Nabble.com.
>>
>> ___
>> 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-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
>


-
Best Regards.
Max Kosenko.
--
View this message in context:
http://www.nabble.com/ANN%3A--SQLite-3.6.16.C--tp24764742p24777007.html
Sent from the SQLite mailing list archive at Nabble.com.

___
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] Java Code to Generate Foreign Key Constraint Trigger

2009-08-02 Thread Phil Jacobsma

This is a Java method that will create a SQLite foreign key constraint for
inserts or updates.  You pass in the action (Insert, Update), the table
name, the foreign key field name, the foreign table name, and the foreign
table key field name.


public String createForeignKeyConstraint(String action, String table,
String foreignKey, String foriegnTable,
String foreignField){
StringBuilder sb = new StringBuilder();
sb.append("CREATE TRIGGER
").append(table).append("_FK_").append(foreignKey).append("_").append(action).append("
");
sb.append("BEFORE ").append(action).append(" ON 
").append(table).append("
");
sb.append("FOR EACH ROW BEGIN SELECT RAISE(ROLLBACK, ");
sb.append("'").append(action).append(" on table 
").append(table);
sb.append(" violates foreign key constraint for column:
").append(foreignKey).append("') ");
sb.append("WHERE  NEW.").append(foreignKey).append(" IS NOT 
NULL ");
sb.append("AND (SELECT ").append(foreignField).append(" FROM
").append(foriegnTable).append(" ");
sb.append("WHERE ").append(foreignField).append(" =
NEW.").append(foreignKey).append(") IS NULL; END; ");

return sb.toString();
}

-- 
View this message in context: 
http://www.nabble.com/Java-Code-to-Generate-Foreign-Key-Constraint-Trigger-tp24779328p24779328.html
Sent from the SQLite mailing list archive at Nabble.com.

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


Re: [sqlite] ANN: SQLite 3.6.16.C#

2009-08-02 Thread P Kishor
On Sun, Aug 2, 2009 at 7:57 AM, Noah Hart wrote:
>
> Richard sent me a gentle reminder that read in part:
>
> 
> Please also note that the SQLite source code is in the public domain, but
> the "SQLite" name is not.  SQLite is a registered trade mark.  If I don't
> defend the trademark, then I could lose it.  So, I really do need to insist
> that you not use the name "SQLite" for your product.
> 
>
>
> This is an excellent reminder, and until this is done, I've removed access
> to the source code and will terminate this google code project.  I'll post
> an announcement in the future when the new project is ready.


A very valid point from DRH re. protecting the sanctity of SQLite, the
(tm), but the horse may have already left the stable. A quick search
on macupdate.com reveals the following products with ‘SQLite’ in their
name (with the indicated capitalization) --

MesaSQLite
SQLite Migrator
SQLite Diff
SQLiteManager X

and

SqliteQuery

I am sure there are more on Win and *nix platforms.

One question might be -- if one chooses a name that does not have
‘SQLite’ or any variations thereof in it (from what I can see, Noah
called the product ‘sqlitecs’), then how does one indicate that the
product is built on or inspired by SQLite? Also, is SQLite
trademarked, or sqlite or both?

I thought Tito Ciuro’s now-in-limbo QuickLite was very cleverly named,
but it is generally gonna be difficult to avoid mention of SQLite in
the name.


>
> Also, if anyone has an ideal about what to call it ...
> Regards,
>
> Noah Hart
>
>
>
> Noah Hart wrote:
>>
>> I am pleased to announce that the C# port is done to the point where
>> others can look at it.
>>
>> The project is located at http://code.google.com/p/sqlitecs
>>
>> Enjoy,
>>
>> Noah Hart
>>
>




-- 
Puneet Kishor http://www.punkish.org
Carbon Model http://carbonmodel.org
Charter Member, Open Source Geospatial Foundation http://www.osgeo.org
Science Commons Fellow, http://sciencecommons.org/about/whoweare/kishor
Nelson Institute, UW-Madison http://www.nelson.wisc.edu
---
Assertions are politics; backing up assertions with evidence is science
===
Sent from Madison, WI, United States
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] ANN: SQLite 3.6.16.C#

2009-08-02 Thread Tim Anderson
What about SqlSharp?

Tim

> -Original Message-
> From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-
> boun...@sqlite.org] On Behalf Of Noah Hart
> Sent: 02 August 2009 13:58
> To: sqlite-users@sqlite.org
> Subject: Re: [sqlite] ANN: SQLite 3.6.16.C#
> 
> Also, if anyone has an ideal about what to call it ...
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] ANN: SQLite 3.6.16.C#

2009-08-02 Thread Noah Hart

Richard sent me a gentle reminder that read in part:


Please also note that the SQLite source code is in the public domain, but
the "SQLite" name is not.  SQLite is a registered trade mark.  If I don't
defend the trademark, then I could lose it.  So, I really do need to insist
that you not use the name "SQLite" for your product.



This is an excellent reminder, and until this is done, I've removed access 
to the source code and will terminate this google code project.  I'll post
an announcement in the future when the new project is ready.

Also, if anyone has an ideal about what to call it ...
Regards,

Noah Hart   



Noah Hart wrote:
> 
> I am pleased to announce that the C# port is done to the point where
> others can look at it.
> 
> The project is located at http://code.google.com/p/sqlitecs
> 
> Enjoy,
> 
> Noah Hart
> 

-- 
View this message in context: 
http://www.nabble.com/ANN%3A--SQLite-3.6.16.C--tp24764742p24777619.html
Sent from the SQLite mailing list archive at Nabble.com.

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


Re: [sqlite] ANN: SQLite 3.6.16.C#

2009-08-02 Thread Kosenko Max

9/30054 means 99.97% tests are working.
That's a great achievement anyway.
Performance problems can be profiled and optimized simpler than with native
version.

That isn't a nature of managed code to be slow. i.e. Perst DB which is
managed from scratch is same speed or faster than SQLite (especially on
embedded platforms). That's not because of C#, but because of different
architecture, but still it shows that there are plenty of room. So don't
froze this project please - there is a high demand on it exist.

Max


Noah Hart wrote:
> 
> Max, I missed posting the remaining errors
> 
> Current results ... 
> 9 errors out of 30054 tests
> 
> Still skipping about 9 additional tests
> 
> Noah
> 
> Kosenko Max wrote:
>> 
>> Wow, that's impressive.
>> 
>> And very interesting that you've gained 3x-5x performance gain.
>> Don't make this project educational only. I'm sure you'll find additional
>> contributors. Just recently Miguel de Icaza was asking for line by line
>> port of SQLite to C#.
>> 
>> Great achievement that all tests are passing now.
>> 
>> Max.
>> 
>> 
>> Noah Hart wrote:
>>> 
>>> I am pleased to announce that the C# port is done to the point where
>>> others can look at it.
>>> 
>>> The project is located at http://code.google.com/p/sqlitecs
>>> 
>>> Enjoy,
>>> 
>>> Noah Hart
>>> 
>> 
> 
> 


-
Best Regards.
Max Kosenko.
-- 
View this message in context: 
http://www.nabble.com/ANN%3A--SQLite-3.6.16.C--tp24764742p24776975.html
Sent from the SQLite mailing list archive at Nabble.com.

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


Re: [sqlite] ANN: SQLite 3.6.16.C#

2009-08-02 Thread Kosenko Max

I don't know why you have decided that C# or Java isn't competitive to native
compiled code.
After JIT there is no VM between Java/.NET and OS.

While C has better compiler than C# it still don't have JIT engine that can
optimize your code for specific hardware you're running on right now. Or it
can recompile code based on statistics. Options unavailable to native code.
And after all having managed implementation gives better control on code,
simpler code and so on. So in reality there should be strong reason for NOT
using managed implementations for whatever. But it's only rising now...


Jim Showalter-4 wrote:
> 
> Could we not disparage different OSs and languages?
> 
> A fair comparison of performance isn't between a C and C# 
> implementation of SQLite, but between a C# and Java implementation of 
> SQLite. Both C# and Java are managed languages that run atop a VM that 
> runs atop an OS. C is down on the metal. I would expect the C version 
> to be faster.
> 
> I don't know the background of why this programmer did a port directly 
> to C# instead of binding C# to the existing C library, but I assume he 
> had his reasons.
> 
> - Original Message - 
> From: "Fred Williams" 
> To: "General Discussion of SQLite Database" 
> Sent: Saturday, August 01, 2009 6:08 AM
> Subject: Re: [sqlite] ANN: SQLite 3.6.16.C#
> 
> 
>>
>> Hummm... Guess there is a reason there are no implementations of C# 
>> external
>> to the Mickeysoft world :-)
>>
>> Guess if I had a lot of time to kill I could port it to Delphi...
>>
>> BTW, what's the memory footprint?
>>
>> Fred
>>
>> -Original Message-
>> From: sqlite-users-boun...@sqlite.org
>> [mailto:sqlite-users-boun...@sqlite.org]on Behalf Of Kosenko Max
>> Sent: Saturday, August 01, 2009 6:22 AM
>> To: sqlite-users@sqlite.org
>> Subject: Re: [sqlite] ANN: SQLite 3.6.16.C#
>>
>>
>>
>> Seems like I've misunderstood your performance results. And they are
>> 3-5times
>> slower than original...
>>
>> -
>> Best Regards.
>> Max Kosenko.
>> --
>> View this message in context:
>> http://www.nabble.com/ANN%3A--SQLite-3.6.16.C--tp24764742p24768252.html
>> Sent from the SQLite mailing list archive at Nabble.com.
>>
>> ___
>> 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-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
> 


-
Best Regards.
Max Kosenko.
-- 
View this message in context: 
http://www.nabble.com/ANN%3A--SQLite-3.6.16.C--tp24764742p24777007.html
Sent from the SQLite mailing list archive at Nabble.com.

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


Re: [sqlite] Use VDBE in extension

2009-08-02 Thread cefbear
Okay, I have givven up implementing direct VDBE access in a loadable extension. 
Last thing I tried was to link the extension against all needed objects. Read:

> cd sqlite/src
> for f in *.c; do gcc -c "$f"; done
> cd ../..
> gcc -shared sqlite/src/*.o ext.o -o ext.so

...or something like that. But then I could not get SQLite's malloc subsystem 
running from within the extension - segfaulted.

Instead of digging even deeper into SQLite, I added some lines of code to 
insert.c and parse.y - diff is attached (yes, public domain).

I have added "INSERT INTO INDEX [db.]index VALUES(...)" to be able to insert 
into a table's index directly, without having redundant data in table and index.

However, my code does no checking for correct values or unique constraints. it 
just inserts what you throw at it :)

Accessing the data only works if the query uses the index, for example:

> CREATE TABLE t (a INTEGER, b TEXT);
> CREATE UNIQUE INDEX i ON t (a, b);
> 
> INSERT INTO t VALUES (1, "a");
> INSERT INTO INDEX i VALUES (2, "b");
> 
> SELECT * FROM t; -- access table only
>> 1|a
> SELECT * FROM t WHERE a > 0; -- access index only
>> 2|b

This saves me about 50% of disk space - 2GB vs. 4GB :)

Cheers
--- cvs-090731/sqlite/src/insert.c  2009-07-24 19:58:53.0 +0200
+++ cvs-090725-183100/sqlite/src/insert.c   2009-07-31 13:05:53.155154176 
+0200
@@ -1060,6 +1060,90 @@
   sqlite3DbFree(db, aRegIdx);
 }
 
+void sqlite3InsertIntoIndex(
+   Parse *pParse,/* Parser context */
+   SrcList *pIdxName,/* Name of index into which we are inserting */
+   ExprList *pValues/* List of values to be inserted */
+){
+   sqlite3 *db;
+   Index *pIdx;
+   char *zIdx;
+   const char *zDb;
+   Vdbe *v;
+   int nColumn;
+   int iDb;
+   Db *pDb;
+   int i;
+   
+   assert( pIdxName->nSrc==1 );
+   
+   db = pParse->db;
+   v = sqlite3GetVdbe(pParse);
+   if( v== 0 ){
+   sqlite3ErrorMsg(pParse, "Could not init VDBE", 0);
+   goto insert_cleanup;
+   }
+   
+   zIdx = pIdxName->a[0].zName;
+   //if( NEVER(zIdx==0) ) goto insert_cleanup;
+   zDb = pIdxName->a[0].zDatabase;
+   
+   pIdx = sqlite3FindIndex(pParse->db, zIdx, zDb);
+   if( pIdx==0 ){
+   sqlite3ErrorMsg(pParse, "no such index: %S", pIdxName, 0);
+   goto insert_cleanup;
+   }
+   
+   /* insert must cover all index fields */
+   if( pIdx->nColumn!=pValues->nExpr ){
+   sqlite3ErrorMsg(pParse, "%i values for %i columns", 
pValues->nExpr, pIdx->nColumn);
+   goto insert_cleanup;
+   }
+   
+   iDb = sqlite3SchemaToIndex(db, pIdx->pSchema);
+   
+   sqlite3BeginWriteOperation(pParse, 0, iDb);
+   
+   KeyInfo *pKey = sqlite3IndexKeyinfo(pParse, pIdx);
+   
+   int iMem = ++pParse->nMem;
+   pParse->nMem += pValues->nExpr + 3; // values, rowid, record, rowcount
+   
+   // open cursor 0 on index
+   sqlite3VdbeAddOp4(v, OP_OpenWrite, 0, pIdx->tnum, iDb, (char*)pKey, 
P4_KEYINFO_HANDOFF);
+   
+   // push values onto stack
+   for( i=0; inExpr; i++ ){
+   sqlite3ExprCode(pParse, pValues->a[i].pExpr, ++iMem);
+   }
+   
+   // pseudo row id (zero)
+   sqlite3VdbeAddOp2(v, OP_Integer, 0, ++iMem);
+   
+   // build index record
+   sqlite3VdbeAddOp3(v, OP_MakeRecord, (iMem - pValues->nExpr - 1), 
pValues->nExpr+1, ++iMem);
+   sqlite3IndexAffinityStr(v, pIdx);
+   
+   // insert
+   sqlite3VdbeAddOp2(v, OP_IdxInsert, 0, iMem);
+   
+   // close cursor 0
+   sqlite3VdbeAddOp1(v, OP_Close, 0);
+   
+   if( db->flags & SQLITE_CountRows ){
+   // set row count
+   sqlite3VdbeAddOp2(v, OP_Integer, 1, ++iMem);
+   sqlite3VdbeAddOp2(v, OP_ResultRow, iMem, 1);
+   }
+   sqlite3VdbeSetNumCols(v, 1);
+   sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "rows inserted", 
SQLITE_STATIC);
+   
+insert_cleanup:
+   
+   sqlite3SrcListDelete(db, pIdxName);
+   sqlite3ExprListDelete(db, pValues);
+}
+
 /*
 ** Generate code to do constraint checks prior to an INSERT or an UPDATE.
 **
--- cvs-090731/sqlite/src/parse.y   2009-07-03 17:37:28.0 +0200
+++ cvs-090725-183100/sqlite/src/parse.y2009-07-29 18:39:43.757241718 
+0200
@@ -687,6 +687,9 @@
 cmd ::= insert_cmd(R) INTO fullname(X) inscollist_opt(F) DEFAULT VALUES.
 {sqlite3Insert(pParse, X, 0, 0, F, R);}
 
+cmd ::= insert_cmd INTO INDEX fullname(X) VALUES LP itemlist(Y) RP.
+{sqlite3InsertIntoIndex(pParse, X, Y);}
+
 %type insert_cmd {int}
 insert_cmd(A) ::= INSERT orconf(R).   {A = R;}
 insert_cmd(A) ::= REPLACE.{A = OE_Replace;}
___
sqlite-users mailing list
sqlite-users@sqlite.org

Re: [sqlite] A memvfs for loading/saving database from buffer

2009-08-02 Thread stephen liu
http://sphivedb.googlecode.com/files/spmemvfs-0.2.src.tar.gz

The demo code:

typedef struct spmembuffer_t {
char * data;
int used;
int total;
} spmembuffer_t;

typedef struct spmemvfs_db_t {
sqlite3 * handle;
spmembuffer_t * mem;
} spmemvfs_db_t;

void test( spmemvfs_db_t * db )
{
..
// do whatever you want
errcode = sqlite3_exec( db->handle, .. );
..
}

int readFile( const char * path, spmembuffer_t * mem )
{
  // read file content from path
}

int writeFile( const char * path, spmembuffer_t * mem )
{
  // write buffer into file
}

int main( int argc, char * argv[] )
{
const char * path = "abc.db";

spmemvfs_db_t db;

spmembuffer_t * mem = (spmembuffer_t*)calloc( sizeof(
spmembuffer_t ), 1 );

spmemvfs_env_init();

readFile( path, mem );
spmemvfs_open_db( , path, mem );

assert( db.mem == mem );

test(  );

writeFile( path, db.mem );

spmemvfs_close_db(  );

spmemvfs_env_fini();

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


Re: [sqlite] ANN: SQLite 3.6.16.C#

2009-08-02 Thread Florian Weimer
* Noah Hart:

> I am pleased to announce that the C# port is done to the point where others
> can look at it.

Congratulations!

(Is there something similar for Java, not using JNI nor NestedVM? 8-)
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users