Re: [sqlite] Database sharing across processes

2012-07-06 Thread Jonathan Haws

Thanks, Pavel, for answering my questions!


>> I am also thinking that I may want to make use of the sqlite_unlock_notify() 
>> call to ensure that if I try to write to the database and it fails to get a 
>> lock, it will pend until it is available.  However, I thought that a query 
>> would pend until it gets a lock anyway.  Is that not the case?

>sqlite3_unlock_notify() works only with shared-cache mode within one
>process. It doesn't work in inter-process locking. And by default
>query won't be pending until locking is possible. If you use function
>sqlite3_busy_timeout() you can obtain behavior close to what you want.

So, then what is the best way to make a query from one process pend until the 
database is available?

For example, let's say I have two processes that connect to the same database 
file.  One process wants to read from the database, but the other process is in 
the middle of a write.  Does the first process pend on the read or not?  If it 
does not, what does it return?  Is it a successful read?  What about the 
reverse case when the first process wants to write but the second process is 
reading?  Is this what I would use sqlite3_busy_timeout() for?

Thanks for the help!

Jonathan

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


Re: [sqlite] Inserting from another table... (resolved)

2012-07-06 Thread Sam Carleton
Folks, I would like to thank one and all, I think this was a group effort.
I changed the double quotes to single, changed the value into a select and
then just ran the select part and found one NULL filed because I had the
wrong category.  Fixed that and left it as a select and all is well!  Thank
you, one and all!

On Fri, Jul 6, 2012 at 4:58 PM, Keith Medcalf  wrote:

>
> You should probably replace all the " with ' as well.  " is for
> identifiers (column/table names, etc.).  ' is for strings.
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite Provenance

2012-07-06 Thread Stephan Beal
On Sat, Jul 7, 2012 at 3:05 AM, PJ Naughter  wrote:

> I would disagree that static code analysis is not useful for plain C code
> as
> opposed to C++.


Nowhere do they docs say that. They say they have not proven to be an
effective use of time *for sqlite3*. In fact, they qualify their statement
3 times in this paragraph:

"Static analysis has not proven to be especially helpful in finding bugs *in
SQLite*. Static analysis has found a few bugs *in SQLite*, but those are
the exceptions. More bugs have been introduced *into SQLite* while trying
to get it to compile without warnings than have been found by static
analysis."


-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite Provenance

2012-07-06 Thread PJ Naughter
I would disagree that static code analysis is not useful for plain C code as
opposed to C++. I have used SQLite3 in Visual C++ 2010 with SP1 for Windows
x86 compilation using its' static code analysis command line option of
/analyze as well as using level 4 compilation (/W4) and there are a number
of warnings reported in the sqlite3.c amalgamation file (where the
pre-processor value for SQLITE_VERSION is "3.6.12.1"), which I would love to
see fixed in the SQLite code base. 

FYI here are the reported issues / warnings:

1>-- Rebuild All started: Project: SQLiteDemo, Configuration: Debug
Win32 --
1>  stdafx.cpp
1>  sqlite3.c
1>d:\dev\sqlite\sqlite3.c(21016): warning C4127: conditional expression is
constant
1>d:\dev\sqlite\sqlite3.c(21018): warning C4127: conditional expression is
constant
1>d:\dev\sqlite\sqlite3.c(21023): warning C4127: conditional expression is
constant
1>d:\dev\sqlite\sqlite3.c(32371): warning C4232: nonstandard extension used
: 'pCurrent' : address of dllimport 'AreFileApisANSI' is not static,
identity not guaranteed
1>  c:\program files (x86)\microsoft
sdks\windows\v7.0a\include\winbase.h(10430) : see declaration of
'AreFileApisANSI'
1>d:\dev\sqlite\sqlite3.c(32394): warning C4232: nonstandard extension used
: 'pCurrent' : address of dllimport 'CloseHandle' is not static, identity
not guaranteed
1>  c:\program files (x86)\microsoft
sdks\windows\v7.0a\include\winbase.h(5068) : see declaration of
'CloseHandle'
1>d:\dev\sqlite\sqlite3.c(32399): warning C4232: nonstandard extension used
: 'pCurrent' : address of dllimport 'CreateFileA' is not static, identity
not guaranteed
1>  c:\program files (x86)\microsoft
sdks\windows\v7.0a\include\winbase.h(9269) : see declaration of
'CreateFileA'
1>d:\dev\sqlite\sqlite3.c(32408): warning C4232: nonstandard extension used
: 'pCurrent' : address of dllimport 'CreateFileW' is not static, identity
not guaranteed
1>  c:\program files (x86)\microsoft
sdks\windows\v7.0a\include\winbase.h(9282) : see declaration of
'CreateFileW'
1>d:\dev\sqlite\sqlite3.c(32416): warning C4232: nonstandard extension used
: 'pCurrent' : address of dllimport 'CreateFileMappingA' is not static,
identity not guaranteed
1>  c:\program files (x86)\microsoft
sdks\windows\v7.0a\include\winbase.h(7024) : see declaration of
'CreateFileMappingA'
1>d:\dev\sqlite\sqlite3.c(32422): warning C4232: nonstandard extension used
: 'pCurrent' : address of dllimport 'CreateFileMappingW' is not static,
identity not guaranteed
1>  c:\program files (x86)\microsoft
sdks\windows\v7.0a\include\winbase.h(7036) : see declaration of
'CreateFileMappingW'
1>d:\dev\sqlite\sqlite3.c(32431): warning C4232: nonstandard extension used
: 'pCurrent' : address of dllimport 'CreateMutexW' is not static, identity
not guaranteed
1>  c:\program files (x86)\microsoft
sdks\windows\v7.0a\include\winbase.h(6672) : see declaration of
'CreateMutexW'
1>d:\dev\sqlite\sqlite3.c(32440): warning C4232: nonstandard extension used
: 'pCurrent' : address of dllimport 'DeleteFileA' is not static, identity
not guaranteed
1>  c:\program files (x86)\microsoft
sdks\windows\v7.0a\include\winbase.h(9523) : see declaration of
'DeleteFileA'
1>d:\dev\sqlite\sqlite3.c(32448): warning C4232: nonstandard extension used
: 'pCurrent' : address of dllimport 'DeleteFileW' is not static, identity
not guaranteed
1>  c:\program files (x86)\microsoft
sdks\windows\v7.0a\include\winbase.h(9529) : see declaration of
'DeleteFileW'
1>d:\dev\sqlite\sqlite3.c(32473): warning C4232: nonstandard extension used
: 'pCurrent' : address of dllimport 'FlushFileBuffers' is not static,
identity not guaranteed
1>  c:\program files (x86)\microsoft
sdks\windows\v7.0a\include\winbase.h(4929) : see declaration of
'FlushFileBuffers'
1>d:\dev\sqlite\sqlite3.c(32478): warning C4232: nonstandard extension used
: 'pCurrent' : address of dllimport 'FormatMessageA' is not static, identity
not guaranteed
1>  c:\program files (x86)\microsoft
sdks\windows\v7.0a\include\winbase.h(5687) : see declaration of
'FormatMessageA'
1>d:\dev\sqlite\sqlite3.c(32487): warning C4232: nonstandard extension used
: 'pCurrent' : address of dllimport 'FormatMessageW' is not static, identity
not guaranteed
1>  c:\program files (x86)\microsoft
sdks\windows\v7.0a\include\winbase.h(5699) : see declaration of
'FormatMessageW'
1>d:\dev\sqlite\sqlite3.c(32495): warning C4232: nonstandard extension used
: 'pCurrent' : address of dllimport 'FreeLibrary' is not static, identity
not guaranteed
1>  c:\program files (x86)\microsoft
sdks\windows\v7.0a\include\winbase.h(2611) : see declaration of
'FreeLibrary'
1>d:\dev\sqlite\sqlite3.c(32499): warning C4232: nonstandard extension used
: 'pCurrent' : address of dllimport 'GetCurrentProcessId' is not static,
identity not guaranteed
1>  c:\program files (x86)\microsoft
sdks\windows\v7.0a\include\winbase.h(3500) : see declaration of
'GetCurrentProcessId

Re: [sqlite] SQLite Provenance

2012-07-06 Thread Stephan Beal
On Sat, Jul 7, 2012 at 12:24 AM, Gavin T Watt  wrote:

> BTW, do you know if the SQLite team runs any kind of static code analysis
> on the source?
>

http://www.sqlite.org/testing.html

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite Provenance

2012-07-06 Thread Simon Slavin

On 6 Jul 2012, at 11:24pm, Gavin T Watt  wrote:

> BTW, do you know if the SQLite team runs any kind of static code analysis
> on the source?

SQLite is plain C code.  Note even C++.  So static code analysis is tricky and 
not likely to be much use.  However, Clang static analysis has been applied and 
it's the last item you can find in the long list of tests listed on this page:



What is more useful than static code analysis is testing with corrupted 
database files, with boundary value tests and with valgrind.

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


Re: [sqlite] SQLite Provenance

2012-07-06 Thread Simon Slavin

On 6 Jul 2012, at 11:10pm, Nico Williams  wrote:

> What the OP is interested in, most likely, is that SQLite3 is not from
> Cuba, Iran, North Korea, ...

This is the question: what does 'from' (or in the original, 'Provenance') mean. 
 SQLite3 is the API which, the way the team recommend we use it, is two files: 
one .h file and one .c file.  There are copies in every Linux and Mac OS 
installation I've ever seen.  Chances are the OP's team wouldn't even need to 
download them from an external server.  The form the API comes in a source 
code.  Unless the SQLite team played obfuscated C tricks, what they accept is 
all source code: if they think something sneaky has been built in to steal 
their data, the OP's team can just sit there and read the amalgamation from 
beginning to end.

I would say SQLite is the very model for contributed code which even the most 
sensitive and secure project would be able to accept from outside the team.  Of 
course, Richard Hipp was born in the '60s, got a Doctorate of Philosophy from 
Duke and then /didn't/ proceed to academia, which means he's probably a commie 
hippy.  That might put the kibosh on it.

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


Re: [sqlite] SQLite Provenance

2012-07-06 Thread Gavin T Watt
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

I totally agree with you about about the server location being of little
interest, really, and that the having access to the source is much more
important. However, my customer wanted me to check this anyway,a nd you've
answered the mail.

BTW, do you know if the SQLite team runs any kind of static code analysis
on the source?


Gavin Watt, CISSP
Sr. Prin. Sys. Engr.
Information Assurance
Network Centric Systems (NCS)

714-446-3104 (office)
714-234-8869 (BB)
714-446-4136 (fax)
gw...@raytheon.com

120 S. St. College Blvd..
Mail Station: FU/679/H118
Brea, Ca.  92821, USA



From: Roger Binns 
To: General Discussion of SQLite Database 
Date: 07/06/2012 03:05 PM
Subject: Re: [sqlite] SQLite Provenance
Sent by: sqlite-users-boun...@sqlite.org



* PGP Signed by an unknown key

On 06/07/12 14:58, Gavin T Watt wrote:
> ... the provenance of SQLite for security reasons.

Where the server is is of little interest.  It would be good if the team
actually signed the release in some way then at least you would know it
was what they released.

What is of more importance is that you have access to the code (which
everyone does) and where the code came from.  Especially note the first
and third paragraphs here:

  http://www.sqlite.org/copyright.html

Roger

* Unknown Key
* 0x0DFBD904(L)
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


-BEGIN PGP SIGNATURE-
Version: PGP Desktop 10.2.0 (Build 2068)
Charset: utf-8

wsBVAwUBT/dlmo8W3Wkt3UsBAQiR/wgAgcCQ0mcJMWRP9G5aCUp1b5/cWAaoyHbI
2aNHKRdtwST9ugtt6lk2AnEjtIqjM4C9jMudCWsxh2qB+gVguJQhbPegLiVOGHI+
1axfwIiGOMqdgba2BW+uQVbWYHMfsm4u3wThS91S2BwZR4TWGRdbkjg5IxV72JGH
KTvuNLC5Dv6p3f1sOK7qSV7HVsQmFYjXGsWWb1U2MHuJH0rZ0KsVCa0mu6zFdRur
jddMFu8wWrNEOMSozsI+mWWn2k68mBj2CblbkIho9lScHJiGKlK5o75anmqw8xQj
4fsYmUsEjTqanaeRrU3CNKMuphseyW8cYnVrt1+BY67chMipKTm54w==
=P9aB
-END PGP SIGNATURE-___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite Provenance

2012-07-06 Thread Nico Williams
What the OP is interested in, most likely, is that SQLite3 is not from
Cuba, Iran, North Korea, ...
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite Provenance

2012-07-06 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 06/07/12 14:58, Gavin T Watt wrote:
> ... the provenance of SQLite for security reasons.

Where the server is is of little interest.  It would be good if the team
actually signed the release in some way then at least you would know it
was what they released.

What is of more importance is that you have access to the code (which
everyone does) and where the code came from.  Especially note the first
and third paragraphs here:

  http://www.sqlite.org/copyright.html

Roger
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)

iEYEARECAAYFAk/3YSIACgkQmOOfHg372QQ3CQCgy2nibULQKd8G59yd8yziXwcg
oHcAn3QLJ2qjtfkkc9n1sk2TXMSqryGv
=Ad6+
-END PGP SIGNATURE-
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite Provenance

2012-07-06 Thread Gavin T Watt
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Thanks for the information.

Not a Jingoistic quest, but we're using SQLite in a system for which there
is an interest in the provenance of SQLite for security reasons. With the
server ins Dalls, we golden!


Gavin Watt, CISSP
Sr. Prin. Sys. Engr.
Information Assurance
Network Centric Systems (NCS)

714-446-3104 (office)
714-234-8869 (BB)
714-446-4136 (fax)
gw...@raytheon.com

120 S. St. College Blvd..
Mail Station: FU/679/H118
Brea, Ca.  92821, USA



From: Roger Binns 
To: General Discussion of SQLite Database 
Date: 07/06/2012 11:01 AM
Subject: Re: [sqlite] SQLite Provenance
Sent by: sqlite-users-boun...@sqlite.org



* PGP Signed by an unknown key

On 06/07/12 08:29, Gavin T Watt wrote:
> Can anyone tell me where (what country) the SQLite server(s) are
> located?

Go to http://centralops.net and enter the site of interest into domain
dossier.

You will see that the sqlite.org domain name is openly registered (not
hidden by a privacy/anonymity registrar) and that the IP address it is
hosted on belongs to Linode who obtained it as a block from ThePlanet
internet services.

If you tick traceroute at the top then you can deduce from the traceroute
(at the bottom) that particular IP address is in Dallas.

If this is some sort of jingoistic quest then all companies involved are
American.

Roger

* Unknown Key
* 0x0DFBD904(L)
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


-BEGIN PGP SIGNATURE-
Version: PGP Desktop 10.2.0 (Build 2068)
Charset: utf-8

wsBVAwUBT/dflI8W3Wkt3UsBAQimkQf+M4Fylk+jIEdYmU9qoz8pexgmeMFVgDBo
E22D6T91QrzfBp+8zTtuMCIVYe31Sv+H2E3rdfWuP+xLM82OqldSylv/eaG0uRXl
fRCISD63mvnJpBY63LS9r2tWbw5+1JCsDtLVzcwOTLrRoreBvXT5RXbZKe5g+j84
JZVtZZrjAMyiaw2XC3uyoq8I71HC5wCyYjYuWd+QwaqLGwndC9Nvtua1opXHzTC5
hviMgkhfbq2+q7ZUu1IiBCDPk255aG8tx83sxn2RiKyI6voBMFVJE1E1sv1vvykE
uL7wj4ybw2UDKkgcsBFmAaQDb228tGghbSXqB28npuVpTtugLPRkFg==
=G2iZ
-END PGP SIGNATURE-___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Inserting from another table...

2012-07-06 Thread Keith Medcalf

You should probably replace all the " with ' as well.  " is for identifiers 
(column/table names, etc.).  ' is for strings.

---
()  ascii ribbon campaign against html e-mail
/\  www.asciiribbon.org


> -Original Message-
> From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-
> boun...@sqlite.org] On Behalf Of Keith Medcalf
> Sent: Friday, 06 July, 2012 13:29
> To: General Discussion of SQLite Database
> Subject: Re: [sqlite] Inserting from another table...
> 
> 
> Does saying what you want to do this way work better?
> 
> insert into PP_VIEWER_SETTINGS
> (COMPANY_NAME, DSPNEXTPREVIOUS, ENABLE_CARTS, ENABLE_DEBUGINFO,
>  ENABLE_FAVORITES, ENABLE_RIGHTCLICK, ENABLE_SLIDESHOW,
>  ENABLE_TIMEOUT, EXIT_KVS, EXIT_PASSWORD, IS_CART_FAVORITES,
>  IS_LOGIN_REQUIRED, IMAGE_SIZE, PHONE_NUM_FORMAT, THEME_ID,
>  THUMBNAIL_SIZE, TICKER_MSG, TO_AFTER, TO_STARTS,
>  TO_TRANSITION_SECS, SS_COUNT, SS_DEFAULT_IS_IN_SLIDESHOW,
>  SS_DISPLAY_SECONDS, SS_ZOOM_FACTOR, USERLAN)
> select (select ItemValue from dblookup where Category = "KvsSettings" and
> ItemName = "Company"),
>(select ItemValue from dblookup where Category = "KvsSettings" and
> ItemName = "DspNextPrevious"),
>(select ItemValue from dblookup where Category = "KvsSettings" and
> ItemName = "EnableCarts"),
>(select ItemValue from dblookup where Category = "KvsSettings" and
> ItemName = "EnableDebugInfo"),
>(select ItemValue from dblookup where Category = "KvsSettings" and
> ItemName = "EnableFavorites"),
>(select ItemValue from dblookup where Category = "KvsSettings" and
> ItemName = "EnableRightClick"),
>(select ItemValue from dblookup where Category = "KvsSettings" and
> ItemName = "EnableSlideShow"),
>1,
>(select ItemValue from dblookup where Category = "KvsSettings" and
> ItemName = "ExitKvs"),
>(select ItemValue from dblookup where Category = "KvsSettings" and
> ItemName = "ExitPassword"),
>(select ItemValue from dblookup where Category = "KvsSettings" and
> ItemName = "IsCartFavorites"),
>(select ItemValue from dblookup where Category = "KvsSettings" and
> ItemName = "IsLoginRequired"),
>900,
>(select ItemValue from dblookup where Category = "KvsSettings" and
> ItemName = "PhoneNumberFormat"),
>0,
>(select ItemValue from dblookup where Category = "KvsSettings" and
> ItemName = "ThumbnailSize"),
>(select ItemValue from dblookup where Category = "KvsSettings" and
> ItemName = "TickerMsg"),
>(select ItemValue from dblookup where Category = "KvsSettings" and
> ItemName = "TimeoutAfter"),
>(select ItemValue from dblookup where Category = "KvsSettings" and
> ItemName = "TimeoutStarts"),
>(select ItemValue from dblookup where Category = "KvsSettings" and
> ItemName = "TransitionSeconds"),
>0,
>(select ItemValue from dblookup where Category = "SlideShowSettings"
> and ItemName = "DefaultIsInSlideShow"),
>(select ItemValue from dblookup where Category = "SlideShowSettings"
> and ItemName = "DisplaySeconds"),
>(select ItemValue from dblookup where Category = "SlideShowSettings"
> and ItemName = "ZoomFactor"),
>(select ItemValue from dblookup where Category = "KvsSettings" and
> ItemName = "USERLAN");
> 
> ---
> ()  ascii ribbon campaign against html e-mail
> /\  www.asciiribbon.org
> 
> 
> 
> 
> ___
> 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] Inserting from another table...

2012-07-06 Thread David Bicking
Have you tried to replace the "Insert into values(" with just "Select (" to 
make sure the values are what you expect them to be. That might also point out 
if any of them are null.

David




 From: Sam Carleton 
To: General Discussion of SQLite Database  
Sent: Thursday, July 5, 2012 11:03 PM
Subject: [sqlite] Inserting from another table...
 
I am working on converting my system table from one form to another.  The
old form was one row per value with a category/key/value (DBLookup) , the
new form is a separate column for each value (PP_VIEWER_SETTINGS).  I am
trying to create an insert statement to run when the new table is created,
but when I run it, it does not work nor do I get any errors in SQLite
manager:

/* The OLD one */
CREATE TABLE DBLookup (
    Category VARCHAR(32) NOT NULL,
    ItemName VARCHAR(128) NOT NULL,
    ItemValue VARCHAR(3000) NOT NULL,
    PRIMARY KEY(Category, ItemName))

/* The NEW one */
CREATE TABLE PP_VIEWER_SETTINGS
(
  VIEWER_SETTINGS_ID                      INTEGER PRIMARY KEY
AUTOINCREMENT,
  COMPANY_NAME                            VARCHAR(   260) NOT NULL,
  DSPNEXTPREVIOUS                        SMALLINT         NOT NULL,
  ENABLE_CARTS                           SMALLINT         NOT NULL,
  ENABLE_DEBUGINFO                       SMALLINT         NOT NULL,
  ENABLE_FAVORITES                       SMALLINT         NOT NULL,
  ENABLE_RIGHTCLICK                      SMALLINT         NOT NULL,
  ENABLE_SLIDESHOW                       SMALLINT         NOT NULL,
  ENABLE_TIMEOUT                         SMALLINT         NOT NULL,
  EXIT_KVS                               SMALLINT         NOT NULL,
  EXIT_PASSWORD                           VARCHAR(    20) NOT NULL,
  IS_CART_FAVORITES                      SMALLINT         NOT NULL,
  IS_LOGIN_REQUIRED                      SMALLINT         NOT NULL,
  IMAGE_SIZE                              INTEGER         NOT NULL,
  PHONE_NUM_FORMAT                        VARCHAR(    20) NOT NULL,
  THEME_ID                                INTEGER         NOT NULL,
  THUMBNAIL_SIZE                         SMALLINT         NOT NULL,
  TICKER_MSG                              VARCHAR(   260) NOT NULL,
  TO_AFTER                               SMALLINT         NOT NULL,
  TO_STARTS                              SMALLINT         NOT NULL,
  TO_TRANSITION_SECS                     SMALLINT         NOT NULL,
  SS_COUNT                               SMALLINT         NOT NULL,
  SS_DEFAULT_IS_IN_SLIDESHOW             SMALLINT         NOT NULL,
  SS_DISPLAY_SECONDS             DOUBLE PRECISION         NOT NULL,
  SS_ZOOM_FACTOR                 DOUBLE PRECISION         NOT NULL,
  USERLAN                                 VARCHAR(   260) NOT NULL
);

/* The insert script */

insert into PP_VIEWER_SETTINGS
    ( COMPANY_NAME, DSPNEXTPREVIOUS, ENABLE_CARTS, ENABLE_DEBUGINFO,
ENABLE_FAVORITES, ENABLE_RIGHTCLICK, ENABLE_SLIDESHOW,
      ENABLE_TIMEOUT, EXIT_KVS, EXIT_PASSWORD, IS_CART_FAVORITES,
IS_LOGIN_REQUIRED, IMAGE_SIZE, PHONE_NUM_FORMAT, THEME_ID,
      THUMBNAIL_SIZE, TICKER_MSG, TO_AFTER, TO_STARTS, TO_TRANSITION_SECS,
SS_COUNT, SS_DEFAULT_IS_IN_SLIDESHOW,
      SS_DISPLAY_SECONDS, SS_ZOOM_FACTOR, USERLAN)
      values (
        (select ItemValue from dblookup where Category = "KvsSettings" and
ItemName = "Company"),
        (select ItemValue from dblookup where Category = "KvsSettings" and
ItemName = "DspNextPrevious"),
        (select ItemValue from dblookup where Category = "KvsSettings" and
ItemName = "EnableCarts"),
        (select ItemValue from dblookup where Category = "KvsSettings" and
ItemName = "EnableDebugInfo"),
        (select ItemValue from dblookup where Category = "KvsSettings" and
ItemName = "EnableFavorites"),
        (select ItemValue from dblookup where Category = "KvsSettings" and
ItemName = "EnableRightClick"),
        (select ItemValue from dblookup where Category = "KvsSettings" and
ItemName = "EnableSlideShow"),
        1,
        (select ItemValue from dblookup where Category = "KvsSettings" and
ItemName = "ExitKvs"),
        (select ItemValue from dblookup where Category = "KvsSettings" and
ItemName = "ExitPassword"),
        (select ItemValue from dblookup where Category = "KvsSettings" and
ItemName = "IsCartFavorites"),
        (select ItemValue from dblookup where Category = "KvsSettings" and
ItemName = "IsLoginRequired"),
        900,
        (select ItemValue from dblookup where Category = "KvsSettings" and
ItemName = "PhoneNumberFormat"),
        0,
        (select ItemValue from dblookup where Category = "KvsSettings" and
ItemName = "ThumbnailSize"),
        (select ItemValue from dblookup where Category = "KvsSettings" and
ItemName = "TickerMsg"),
        (select ItemValue from dblookup where Category = "KvsSettings" and
ItemName = "TimeoutAfter"),
        (select ItemValue from dblookup where Category = "KvsSettings" and
ItemName = "TimeoutStarts"),
        (select ItemValue from dbloo

Re: [sqlite] Inserting from another table...

2012-07-06 Thread Keith Medcalf

Does saying what you want to do this way work better?

insert into PP_VIEWER_SETTINGS
(COMPANY_NAME, DSPNEXTPREVIOUS, ENABLE_CARTS, ENABLE_DEBUGINFO,
 ENABLE_FAVORITES, ENABLE_RIGHTCLICK, ENABLE_SLIDESHOW,
 ENABLE_TIMEOUT, EXIT_KVS, EXIT_PASSWORD, IS_CART_FAVORITES,
 IS_LOGIN_REQUIRED, IMAGE_SIZE, PHONE_NUM_FORMAT, THEME_ID,
 THUMBNAIL_SIZE, TICKER_MSG, TO_AFTER, TO_STARTS,
 TO_TRANSITION_SECS, SS_COUNT, SS_DEFAULT_IS_IN_SLIDESHOW,
 SS_DISPLAY_SECONDS, SS_ZOOM_FACTOR, USERLAN)
select (select ItemValue from dblookup where Category = "KvsSettings" and 
ItemName = "Company"),
   (select ItemValue from dblookup where Category = "KvsSettings" and 
ItemName = "DspNextPrevious"),
   (select ItemValue from dblookup where Category = "KvsSettings" and 
ItemName = "EnableCarts"),
   (select ItemValue from dblookup where Category = "KvsSettings" and 
ItemName = "EnableDebugInfo"),
   (select ItemValue from dblookup where Category = "KvsSettings" and 
ItemName = "EnableFavorites"),
   (select ItemValue from dblookup where Category = "KvsSettings" and 
ItemName = "EnableRightClick"),
   (select ItemValue from dblookup where Category = "KvsSettings" and 
ItemName = "EnableSlideShow"),
   1,
   (select ItemValue from dblookup where Category = "KvsSettings" and 
ItemName = "ExitKvs"),
   (select ItemValue from dblookup where Category = "KvsSettings" and 
ItemName = "ExitPassword"),
   (select ItemValue from dblookup where Category = "KvsSettings" and 
ItemName = "IsCartFavorites"),
   (select ItemValue from dblookup where Category = "KvsSettings" and 
ItemName = "IsLoginRequired"),
   900,
   (select ItemValue from dblookup where Category = "KvsSettings" and 
ItemName = "PhoneNumberFormat"),
   0,
   (select ItemValue from dblookup where Category = "KvsSettings" and 
ItemName = "ThumbnailSize"),
   (select ItemValue from dblookup where Category = "KvsSettings" and 
ItemName = "TickerMsg"),
   (select ItemValue from dblookup where Category = "KvsSettings" and 
ItemName = "TimeoutAfter"),
   (select ItemValue from dblookup where Category = "KvsSettings" and 
ItemName = "TimeoutStarts"),
   (select ItemValue from dblookup where Category = "KvsSettings" and 
ItemName = "TransitionSeconds"),
   0,
   (select ItemValue from dblookup where Category = "SlideShowSettings" and 
ItemName = "DefaultIsInSlideShow"),
   (select ItemValue from dblookup where Category = "SlideShowSettings" and 
ItemName = "DisplaySeconds"),
   (select ItemValue from dblookup where Category = "SlideShowSettings" and 
ItemName = "ZoomFactor"),
   (select ItemValue from dblookup where Category = "KvsSettings" and 
ItemName = "USERLAN");

---
()  ascii ribbon campaign against html e-mail
/\  www.asciiribbon.org




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


Re: [sqlite] Inserting from another table...

2012-07-06 Thread Pavel Ivanov
> The query does not seem to do anything, the table is empty after I run the
> query.

This can only mean that there was some error executing insert. It's
written in a way that it just cannot leave empty table for any reason
except error. You have all columns NOT NULL, so maybe dblookup doesn't
have value for some column and thus the whole insert fails.

> One question...  In the PP_VIEWER_SETTINGS, I have columns of different
> types, but in DBLookup all the values are varchar's.  Since sqlite doesn't
> actually deal with column types, I figured this would not be an issue.
> Might it be?  Should I be casting them to the correct type first?

You don't have to. Your types declared in such way that SQLite will
automatically try to convert all varchar values to integers and
doubles where necessary. If SQLite won't be able to convert it will
insert text value provided. But if you put explicit casting then
SQLite will insert 0 if cast won't be successful.


Pavel


On Fri, Jul 6, 2012 at 2:45 PM, Sam Carleton  wrote:
> Pavel,
>
> The goal is to get them all into one row, correct.
>
> The query does not seem to do anything, the table is empty after I run the
> query.
>
> One question...  In the PP_VIEWER_SETTINGS, I have columns of different
> types, but in DBLookup all the values are varchar's.  Since sqlite doesn't
> actually deal with column types, I figured this would not be an issue.
> Might it be?  Should I be casting them to the correct type first?
>
> Sam
>
> On Thu, Jul 5, 2012 at 11:24 PM, Pavel Ivanov  wrote:
>
>> The insert statement below should insert one row into table
>> PP_VIEWER_SETTINGS. Does it do that? Is it what you called "does not
>> work"? To insert several rows you need to write a huge join of
>> dblookup to itself, so your insert statement should look like this:
>>
>> insert into PP_VIEWER_SETTINGS (...)
>> select a.ItemValue, b.ItemValue, c.ItemValue, ...
>> from dblookup a, dblookup b, dblookup c, ...
>> where a.Category = "KvsSettings"
>> and a.ItemName = "Company"
>> and b.Category = "KvsSettings"
>> and b.ItemName = "DspNextPrevious"
>> and c.Category = "KvsSettings"
>> and c.ItemName = "EnableCarts"
>> ...
>> and a.? = b.?
>> and a.? = c.?
>> ...
>> ;
>>
>> Question marks here is the field which value should identify what row
>> particular ItemName should go to.
>>
>>
>> Pavel
>>
>>
>> On Thu, Jul 5, 2012 at 11:03 PM, Sam Carleton
>>  wrote:
>> > I am working on converting my system table from one form to another.  The
>> > old form was one row per value with a category/key/value (DBLookup) , the
>> > new form is a separate column for each value (PP_VIEWER_SETTINGS).  I am
>> > trying to create an insert statement to run when the new table is
>> created,
>> > but when I run it, it does not work nor do I get any errors in SQLite
>> > manager:
>> >
>> > /* The OLD one */
>> > CREATE TABLE DBLookup (
>> > Category VARCHAR(32) NOT NULL,
>> > ItemName VARCHAR(128) NOT NULL,
>> > ItemValue VARCHAR(3000) NOT NULL,
>> > PRIMARY KEY(Category, ItemName))
>> >
>> > /* The NEW one */
>> > CREATE TABLE PP_VIEWER_SETTINGS
>> > (
>> >   VIEWER_SETTINGS_ID  INTEGER PRIMARY KEY
>> > AUTOINCREMENT,
>> >   COMPANY_NAMEVARCHAR(   260) NOT NULL,
>> >   DSPNEXTPREVIOUSSMALLINT NOT NULL,
>> >   ENABLE_CARTS   SMALLINT NOT NULL,
>> >   ENABLE_DEBUGINFO   SMALLINT NOT NULL,
>> >   ENABLE_FAVORITES   SMALLINT NOT NULL,
>> >   ENABLE_RIGHTCLICK  SMALLINT NOT NULL,
>> >   ENABLE_SLIDESHOW   SMALLINT NOT NULL,
>> >   ENABLE_TIMEOUT SMALLINT NOT NULL,
>> >   EXIT_KVS   SMALLINT NOT NULL,
>> >   EXIT_PASSWORD   VARCHAR(20) NOT NULL,
>> >   IS_CART_FAVORITES  SMALLINT NOT NULL,
>> >   IS_LOGIN_REQUIRED  SMALLINT NOT NULL,
>> >   IMAGE_SIZE  INTEGER NOT NULL,
>> >   PHONE_NUM_FORMATVARCHAR(20) NOT NULL,
>> >   THEME_IDINTEGER NOT NULL,
>> >   THUMBNAIL_SIZE SMALLINT NOT NULL,
>> >   TICKER_MSG  VARCHAR(   260) NOT NULL,
>> >   TO_AFTER   SMALLINT NOT NULL,
>> >   TO_STARTS  SMALLINT NOT NULL,
>> >   TO_TRANSITION_SECS SMALLINT NOT NULL,
>> >   SS_COUNT   SMALLINT NOT NULL,
>> >   SS_DEFAULT_IS_IN_SLIDESHOW SMALLINT NOT NULL,
>> >   SS_DISPLAY_SECONDS DOUBLE PRECISION NOT NULL,
>> >   SS_ZOOM_FACTOR DOUBLE PRECISION NOT NULL,
>> >   USERLAN

Re: [sqlite] Inserting from another table...

2012-07-06 Thread Sam Carleton
Pavel,

The goal is to get them all into one row, correct.

The query does not seem to do anything, the table is empty after I run the
query.

One question...  In the PP_VIEWER_SETTINGS, I have columns of different
types, but in DBLookup all the values are varchar's.  Since sqlite doesn't
actually deal with column types, I figured this would not be an issue.
Might it be?  Should I be casting them to the correct type first?

Sam

On Thu, Jul 5, 2012 at 11:24 PM, Pavel Ivanov  wrote:

> The insert statement below should insert one row into table
> PP_VIEWER_SETTINGS. Does it do that? Is it what you called "does not
> work"? To insert several rows you need to write a huge join of
> dblookup to itself, so your insert statement should look like this:
>
> insert into PP_VIEWER_SETTINGS (...)
> select a.ItemValue, b.ItemValue, c.ItemValue, ...
> from dblookup a, dblookup b, dblookup c, ...
> where a.Category = "KvsSettings"
> and a.ItemName = "Company"
> and b.Category = "KvsSettings"
> and b.ItemName = "DspNextPrevious"
> and c.Category = "KvsSettings"
> and c.ItemName = "EnableCarts"
> ...
> and a.? = b.?
> and a.? = c.?
> ...
> ;
>
> Question marks here is the field which value should identify what row
> particular ItemName should go to.
>
>
> Pavel
>
>
> On Thu, Jul 5, 2012 at 11:03 PM, Sam Carleton
>  wrote:
> > I am working on converting my system table from one form to another.  The
> > old form was one row per value with a category/key/value (DBLookup) , the
> > new form is a separate column for each value (PP_VIEWER_SETTINGS).  I am
> > trying to create an insert statement to run when the new table is
> created,
> > but when I run it, it does not work nor do I get any errors in SQLite
> > manager:
> >
> > /* The OLD one */
> > CREATE TABLE DBLookup (
> > Category VARCHAR(32) NOT NULL,
> > ItemName VARCHAR(128) NOT NULL,
> > ItemValue VARCHAR(3000) NOT NULL,
> > PRIMARY KEY(Category, ItemName))
> >
> > /* The NEW one */
> > CREATE TABLE PP_VIEWER_SETTINGS
> > (
> >   VIEWER_SETTINGS_ID  INTEGER PRIMARY KEY
> > AUTOINCREMENT,
> >   COMPANY_NAMEVARCHAR(   260) NOT NULL,
> >   DSPNEXTPREVIOUSSMALLINT NOT NULL,
> >   ENABLE_CARTS   SMALLINT NOT NULL,
> >   ENABLE_DEBUGINFO   SMALLINT NOT NULL,
> >   ENABLE_FAVORITES   SMALLINT NOT NULL,
> >   ENABLE_RIGHTCLICK  SMALLINT NOT NULL,
> >   ENABLE_SLIDESHOW   SMALLINT NOT NULL,
> >   ENABLE_TIMEOUT SMALLINT NOT NULL,
> >   EXIT_KVS   SMALLINT NOT NULL,
> >   EXIT_PASSWORD   VARCHAR(20) NOT NULL,
> >   IS_CART_FAVORITES  SMALLINT NOT NULL,
> >   IS_LOGIN_REQUIRED  SMALLINT NOT NULL,
> >   IMAGE_SIZE  INTEGER NOT NULL,
> >   PHONE_NUM_FORMATVARCHAR(20) NOT NULL,
> >   THEME_IDINTEGER NOT NULL,
> >   THUMBNAIL_SIZE SMALLINT NOT NULL,
> >   TICKER_MSG  VARCHAR(   260) NOT NULL,
> >   TO_AFTER   SMALLINT NOT NULL,
> >   TO_STARTS  SMALLINT NOT NULL,
> >   TO_TRANSITION_SECS SMALLINT NOT NULL,
> >   SS_COUNT   SMALLINT NOT NULL,
> >   SS_DEFAULT_IS_IN_SLIDESHOW SMALLINT NOT NULL,
> >   SS_DISPLAY_SECONDS DOUBLE PRECISION NOT NULL,
> >   SS_ZOOM_FACTOR DOUBLE PRECISION NOT NULL,
> >   USERLAN VARCHAR(   260) NOT NULL
> > );
> >
> > /* The insert script */
> >
> > insert into PP_VIEWER_SETTINGS
> > ( COMPANY_NAME, DSPNEXTPREVIOUS, ENABLE_CARTS, ENABLE_DEBUGINFO,
> > ENABLE_FAVORITES, ENABLE_RIGHTCLICK, ENABLE_SLIDESHOW,
> >   ENABLE_TIMEOUT, EXIT_KVS, EXIT_PASSWORD, IS_CART_FAVORITES,
> > IS_LOGIN_REQUIRED, IMAGE_SIZE, PHONE_NUM_FORMAT, THEME_ID,
> >   THUMBNAIL_SIZE, TICKER_MSG, TO_AFTER, TO_STARTS,
> TO_TRANSITION_SECS,
> > SS_COUNT, SS_DEFAULT_IS_IN_SLIDESHOW,
> >   SS_DISPLAY_SECONDS, SS_ZOOM_FACTOR, USERLAN)
> >   values (
> > (select ItemValue from dblookup where Category = "KvsSettings"
> and
> > ItemName = "Company"),
> > (select ItemValue from dblookup where Category = "KvsSettings"
> and
> > ItemName = "DspNextPrevious"),
> > (select ItemValue from dblookup where Category = "KvsSettings"
> and
> > ItemName = "EnableCarts"),
> > (select ItemValue from dblookup where Category = "KvsSettings"
> and
> > ItemName = "EnableDebugInfo"),
> > (select ItemValue from dblookup where Category = "KvsSettings"
> and
> > ItemName = "EnableFavorit

Re: [sqlite] SQLite Provenance

2012-07-06 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 06/07/12 08:29, Gavin T Watt wrote:
> Can anyone tell me where (what country) the SQLite server(s) are
> located?

Go to http://centralops.net and enter the site of interest into domain
dossier.

You will see that the sqlite.org domain name is openly registered (not
hidden by a privacy/anonymity registrar) and that the IP address it is
hosted on belongs to Linode who obtained it as a block from ThePlanet
internet services.

If you tick traceroute at the top then you can deduce from the traceroute
(at the bottom) that particular IP address is in Dallas.

If this is some sort of jingoistic quest then all companies involved are
American.

Roger
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.11 (GNU/Linux)

iEYEARECAAYFAk/3J+sACgkQmOOfHg372QSflgCeLJnVvrcQ/l9OJIDv9QvxgAs2
5KkAnjj7EFeMaGbTF9lmGnevGt98gOGf
=F7Cv
-END PGP SIGNATURE-
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] SQLite Provenance

2012-07-06 Thread Stephan Beal
On Fri, Jul 6, 2012 at 5:29 PM, Gavin T Watt  wrote:

> Can anyone tell me where (what country) the SQLite server(s) are located?
>

If i remember Richard's recent presentation properly there are 3 in the US
(west coast, Texas, and east coast) and a newer one in the UK(?).

-- 
- stephan beal
http://wanderinghorse.net/home/stephan/
http://gplus.to/sgbeal
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] SQLite Provenance

2012-07-06 Thread Gavin T Watt

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

Can anyone tell me where (what country) the SQLite server(s) are located?


Gavin Watt, CISSP
Sr. Prin. Sys. Engr.
Information Assurance
Network Centric Systems (NCS)

714-446-3104 (office)
714-234-8869 (BB)
714-446-4136 (fax)
gw...@raytheon.com

120 S. St. College Blvd..
Mail Station: FU/679/H118
Brea, Ca.  92821, USA
-BEGIN PGP SIGNATURE-
Version: PGP Desktop 10.2.0 (Build 2068)
Charset: utf-8

wsBVAwUBT/cEaY8W3Wkt3UsBAQhbYAf/VNDpJBz42Q/1H5rUVQbsoRVJKPiP2qJV
cjqnCNj07g1/PgKkg/+8KXpq2ekuVcZmRa1Nbxvjqvqa3D9FeDK7/GJVhFZvE2Bn
b0FGJrgrg6qzRNYQL8+mjPw75eny/Ugl4LLncQU7UoVdnMhWD4BadCGks4+8kVBf
8eFO3nF2I+59hkCuP7uqDzB33jUz1bOlXTrNlV/CWbuiJ8/veYSToXR4flgW6npr
4ftIoV9VV94/W8tlJODbfvZ8aSCIbpLb9LITz3ketBfnM5R3WLBJrjAyBn1v55Pu
xb4jnJntm9P3inAZffB2qkfdgHL4NR5797IguF7KO70SsJ+AqBvSWg==
=R+P3
-END PGP SIGNATURE-___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] seeking working PDO-Sqlite with php form example

2012-07-06 Thread Simon Slavin

On 5 Jul 2012, at 3:43am, D A  wrote:

> Can anybody explain to me how to set up my sqlite database file with my
> Linux server?
> 
> To my limited knowledge, i have uploaded the following files in a directory
> on my server:
> 
> 1. sqlite.db
> 2. form.php
> 
> Do i have to also upload the command shell??

No.  Assuming you have a platform on which PHP is working, the code for 
accessing a SQLite database is built into PHP [1].  Have you tested PHP ?  Is 
it running ?  Write a little PHP program which just shows a message on the 
screen and put it in the same folder as 'form.php'.  Can you make your server 
execute that program ?  Then you have all the SQLite programming you need.

>  I am confident in the php and
> sqlite code and file paths, but I just cannot get anything to show up on
> screen.  Just a blank page, no action.  I've dealt with permissions as well.

Look for the error log for your (presumably) Apache web server.  I bet you'll 
find an error message in there explaining what's wrong when it tries to execute 
the 'form.php' page.

One guess is that the form.php program isn't expecting to find the database 
file in the same folder as the form.php file itself.  This would be a very 
unusual way to set up anything but a private server, because anyone who could 
run form.php could also download the entire database file from your server.  
Normally databases are hidden away in a folder which your web server would not 
serve.

Simon.

[1] There are some exceptions to this, but that's how things are set up by 
default.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users