Re: [sqlite] Help Creating Tables

2008-08-10 Thread jonwood

Yeah, I'd seen both those links but guess I missed the specific explanation.
Also, I had seen CREATE INDEX but didn't know I needed a separate statement
to add an index to a table column.

Many thanks!


Igor Tandetnik wrote:
> 
> "jonwood" <[EMAIL PROTECTED]> wrote in
> message news:[EMAIL PROTECTED]
>> I'm creating SQLite tables from code and could use help with the
>> following issues:
>>
>> 1. I'd like some tables to include foreign keys. These should be
>> indexed for speed, but they are neither primary keys or unique. But I
>> don't see any option to index a column without it being one of those
>> two?
> 
> See CREATE INDEX statement.
> 
>> 2. In my first attempt at this, I used INT data types for columns. It
>> seemed to be working but when I added AUTOINCREMENT, I get an error
>> that this is only valid with INTEGER types. When I changed INT to
>> INTEGER, it works fine. So what the heck type was used when I
>> specified INT?
> 
> http://www.sqlite.org/autoinc.html
> http://www.sqlite.org/datatype3.html
> 
> INT is treated the same as INTEGER, except that a sequence INTEGER 
> PRIMARY KEY has a special meaning (and has to be spelled precisely this 
> way to acquire said meaning).
> 
>> 3. I've been using VARCHAR(n) but see that the SQLite documentation
>> only documents TEXT. Can anyone provide tips or a link to help me
>> decide which of the two is best?
> 
> There's no difference. SQLite accepts both for compatibility with other 
> DB systems, and treats them exactly the same. In particular, the column 
> of type VARCHAR(n) is _not_ restricted to n characters: it can contain 
> strings of any length.
> 
> Igor Tandetnik
> 
> 
> 
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Help-Creating-Tables-tp18918853p18919968.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] Help Creating Tables

2008-08-10 Thread Igor Tandetnik
"jonwood" <[EMAIL PROTECTED]> wrote in
message news:[EMAIL PROTECTED]
> I'm creating SQLite tables from code and could use help with the
> following issues:
>
> 1. I'd like some tables to include foreign keys. These should be
> indexed for speed, but they are neither primary keys or unique. But I
> don't see any option to index a column without it being one of those
> two?

See CREATE INDEX statement.

> 2. In my first attempt at this, I used INT data types for columns. It
> seemed to be working but when I added AUTOINCREMENT, I get an error
> that this is only valid with INTEGER types. When I changed INT to
> INTEGER, it works fine. So what the heck type was used when I
> specified INT?

http://www.sqlite.org/autoinc.html
http://www.sqlite.org/datatype3.html

INT is treated the same as INTEGER, except that a sequence INTEGER 
PRIMARY KEY has a special meaning (and has to be spelled precisely this 
way to acquire said meaning).

> 3. I've been using VARCHAR(n) but see that the SQLite documentation
> only documents TEXT. Can anyone provide tips or a link to help me
> decide which of the two is best?

There's no difference. SQLite accepts both for compatibility with other 
DB systems, and treats them exactly the same. In particular, the column 
of type VARCHAR(n) is _not_ restricted to n characters: it can contain 
strings of any length.

Igor Tandetnik



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


[sqlite] Help Creating Tables

2008-08-10 Thread jonwood

I'm creating SQLite tables from code and could use help with the following
issues:

1. I'd like some tables to include foreign keys. These should be indexed for
speed, but they are neither primary keys or unique. But I don't see any
option to index a column without it being one of those two?

2. In my first attempt at this, I used INT data types for columns. It seemed
to be working but when I added AUTOINCREMENT, I get an error that this is
only valid with INTEGER types. When I changed INT to INTEGER, it works fine.
So what the heck type was used when I specified INT?

3. I've been using VARCHAR(n) but see that the SQLite documentation only
documents TEXT. Can anyone provide tips or a link to help me decide which of
the two is best? If it makes any difference, I will be storing Unicode text
(16-bits per character).

Thanks!
-- 
View this message in context: 
http://www.nabble.com/Help-Creating-Tables-tp18918853p18918853.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] [C++] Import sqlite3.dll and/or sqlite database as resource in project?

2008-08-10 Thread Doug Currie

On Aug 10, 2008, at 2:12 PM, CAVALO SCHMIDT wrote:

> salutations, using VC++ in WinXP.
>
> I would like to know if it's possible to import and use the
> sqlite3.dll file and/or the sqlite database file as a resource in a
> C++ project, so that it will be integrated to the final Win32
> executable. how would it be possible to use sqlite3_open with a
> database file stored as a resource in the application?

I have no quibble with the other replies to your message; another  
option is EEE

http://www.erikveen.dds.nl/eee/

-- e

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


Re: [sqlite] [C++] Import sqlite3.dll and/or sqlite database as resource in project?

2008-08-10 Thread D. Richard Hipp

On Aug 10, 2008, at 2:12 PM, CAVALO SCHMIDT wrote:

> salutations, using VC++ in WinXP.
>
> I would like to know if it's possible to import and use the
> sqlite3.dll file and/or the sqlite database file as a resource in a
> C++ project, so that it will be integrated to the final Win32
> executable. how would it be possible to use sqlite3_open with a
> database file stored as a resource in the application?


If you want a stand-alone executable, do not use sqlite3.dll.   
Instead, use the source code file "sqlite3.c" and compile it into your  
application.

If you have the content of an SQLite database file stored as a  
constant array of bytes in your program, you could have sqlite3 open  
this constant array as if it were a read-only database file by writing  
and registering your own custom VFS layer that reads from the constant  
byte array rather than a file.  You do not have to modify any of the  
core SQLite code to do this, but you do need to write your own VFS  
module, which will require that you have a deep understanding of how  
the SQLite core operates.


D. Richard Hipp
[EMAIL PROTECTED]



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


Re: [sqlite] [C++] Import sqlite3.dll and/or sqlite databaseasresource in project?

2008-08-10 Thread Igor Tandetnik
"CAVALO SCHMIDT" <[EMAIL PROTECTED]>
wrote in message
news:[EMAIL PROTECTED]
> thank you for your quick response.
> do you mean extracting the file
> temporarily (both the database
> and the DLL) to the program's
> folder?

Not necessarily to program folder (which you may not have write 
permissions to), but to some folder on disk, yes.

> but how would I do this (if this
> question is relevant to this list)?

See FindResource, LoadResource, LockResource, SizeofResource.

Igor Tandetnik 



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


Re: [sqlite] [C++] Import sqlite3.dll and/or sqlite database asresource in project?

2008-08-10 Thread CAVALO SCHMIDT
thank you for your quick response.
do you mean extracting the file
temporarily (both the database
and the DLL) to the program's
folder?
but how would I do this (if this
question is relevant to this list)?
thank you in advance.

2008/8/10, Igor Tandetnik <[EMAIL PROTECTED]>:
> "CAVALO SCHMIDT" <[EMAIL PROTECTED]>
>  wrote in message
>  news:[EMAIL PROTECTED]
>
> > salutations, using VC++ in WinXP.
>  >
>  > I would like to know if it's possible to import and use the
>  > sqlite3.dll file and/or the sqlite database file as a resource in a
>  > C++ project, so that it will be integrated to the final Win32
>  > executable. how would it be possible to use sqlite3_open with a
>  > database file stored as a resource in the application?
>
>
> You would have to extract both from resources to a file on disk at
>  runtime, before you can use them.
>
>  Igor Tandetnik
>
>
>
>  ___
>  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] [C++] Import sqlite3.dll and/or sqlite database asresource in project?

2008-08-10 Thread Igor Tandetnik
"CAVALO SCHMIDT" <[EMAIL PROTECTED]>
wrote in message
news:[EMAIL PROTECTED]
> salutations, using VC++ in WinXP.
>
> I would like to know if it's possible to import and use the
> sqlite3.dll file and/or the sqlite database file as a resource in a
> C++ project, so that it will be integrated to the final Win32
> executable. how would it be possible to use sqlite3_open with a
> database file stored as a resource in the application?

You would have to extract both from resources to a file on disk at 
runtime, before you can use them.

Igor Tandetnik



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


[sqlite] [C++] Import sqlite3.dll and/or sqlite database as resource in project?

2008-08-10 Thread CAVALO SCHMIDT
salutations, using VC++ in WinXP.

I would like to know if it's possible to import and use the
sqlite3.dll file and/or the sqlite database file as a resource in a
C++ project, so that it will be integrated to the final Win32
executable. how would it be possible to use sqlite3_open with a
database file stored as a resource in the application?

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


Re: [sqlite] Possible View bug

2008-08-10 Thread Shawn Wilsher
On Sat, Aug 9, 2008 at 9:39 PM, Igor Tandetnik <[EMAIL PROTECTED]> wrote:
> Your trigger uses a curious syntax for SQL INSERT statement, along the
> lines of
I was hoping it was a bug in my code and not in SQLite.  Thanks for
spotting my fascinating syntax.

Cheers,

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


Re: [sqlite] db vs shell

2008-08-10 Thread Vitali Lovich
Careful when using time.  The bash built-in called time times 1 shell 
statement (including pipes).  The binary in /usr/bin/time only times the 
command given - it does not span pipes.

[EMAIL PROTECTED] wrote:
> On Tue, Jul 29, 2008 at 02:15:54AM -0500, Robert Citek wrote:
>   
>> Are you sure time ignores everything after the pipe?
>> 
>
> Seems to depend on shell version - when I tested it here it definitely
> ignored everything after. Yours seems to do the right thing, which makes
> your sqlite issue an interesting find indeed.
>
> Cheers, Peter
> ___
> 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