Re: [sqlite] Method to load Sqlite DB (disk) directly into memory

2010-09-06 Thread Richard Hipp
On Mon, Sep 6, 2010 at 7:25 PM, Simon Slavin  wrote:

>
> On 7 Sep 2010, at 12:21am, Richard wrote:
>
> > I was wondering if there's a method to directly load a disk DB into
> memory. I'm aware of 2 indirect methods, namely:
> >
> >
> > - create a .dump and .read the created file
> >
> >
> > - attach the disk DB and insert the disk tables into memory tables
>
> Assuming you mean to use the INSERT ... SELECT form of the command to load
> into :memory:, that's probably the fastest way to do it.  It might
> theoretically be possible to block-load the file into memory but I don't
> know of a standard way to do this.
>

The backup API does block loading.  More information at
http://www.sqlite.org/backup.html


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



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


Re: [sqlite] Method to load Sqlite DB (disk) directly into memory

2010-09-06 Thread Richard Hipp
On Mon, Sep 6, 2010 at 7:21 PM, Richard  wrote:

> Hi,
>
>
> I was wondering if there's a method to directly load a disk DB into memory.
> I'm aware of 2 indirect methods, namely:
>
>
> - create a .dump and .read the created file
>
>
> - attach the disk DB and insert the disk tables into memory tables
>

>From the command-line shell, us:

 .restore ?DB? FILE

Where DB is the name of the memory database ("main" if you started the shell
with "sqlite3 :memory:") and FILE is the name of the file that contains your
data.

>From an application use the sqlite3_backup() interface (for which the
".restore" command is a wrapper).



>
>
> I'm using the command line tool. Is there a direct method for this?
>
>
> Thanks,
>
>
> Richard
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



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


Re: [sqlite] Method to load Sqlite DB (disk) directly into memory

2010-09-06 Thread Simon Slavin

On 7 Sep 2010, at 12:21am, Richard wrote:

> I was wondering if there's a method to directly load a disk DB into memory. 
> I'm aware of 2 indirect methods, namely:
> 
> 
> - create a .dump and .read the created file
> 
> 
> - attach the disk DB and insert the disk tables into memory tables

Assuming you mean to use the INSERT ... SELECT form of the command to load into 
:memory:, that's probably the fastest way to do it.  It might theoretically be 
possible to block-load the file into memory but I don't know of a standard way 
to do this.

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


[sqlite] Method to load Sqlite DB (disk) directly into memory

2010-09-06 Thread Richard
Hi,


I was wondering if there's a method to directly load a disk DB into memory. I'm 
aware of 2 indirect methods, namely:


- create a .dump and .read the created file


- attach the disk DB and insert the disk tables into memory tables


I'm using the command line tool. Is there a direct method for this?


Thanks,


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


[sqlite] sqlite3 -has_codec in test suite

2010-09-06 Thread Martin Jenkins
Given:

> ./testfixture
% sqlite3 -has_codec
Error: wrong # args: should be "sqlite3 HANDLE FILENAME ?-vfs VFSNAME?
?-readonly BOOLEAN? ?-create BOOLEAN? ?-nomutex BOOLEAN? ?-fullmutex
BOOLEAN?"

% sqlite3 -has-codec
0

and:

src/tclsqlite.c:if( strcmp(zArg,"-has-codec")==0 ){

are the instances of

"if {[catch {sqlite3 -has_codec} r]...}"

in alter2.test, alter3.test, alter4.test and ioerr.test correct or
should they be replaced with

"if {[catch {sqlite3 -has-codec} r] || $r} {"?

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


Re: [sqlite] Altering primary key in trigger produces incorrect last_insert_rowid() value

2010-09-06 Thread Drake Wilson
Quoth Sergey Shishmintzev , on 2010-09-05 
21:57:24 +0300:
> Hi,
> I'm trying to simulate primitive table inheritance.
> 
> There is my SQL code:
>
> -- when inserting row into table child1
> -- new child1.id must be obtained from base table
> CREATE TRIGGER insert_child1
> AFTER INSERT ON child1 FOR EACH ROW BEGIN
>   INSERT INTO base(n) VALUES(-1);
>   UPDATE child1 SET id=last_insert_rowid() WHERE ROWID = NEW.ROWID;
> END;

Yukko---I wouldn't recommend trying to change a synthetic primary key
of a row almost anytime at all, much less in an AFTER INSERT trigger!

You might consider using views and then doing an INSTEAD OF INSERT
trigger, something like:

CREATE TRIGGER ... INSTEAD OF INSERT ON child1_view FOR EACH ROW BEGIN
  INSERT INTO base (bslots...) VALUES (bvalues...);
  INSERT INTO child1 (id, cslots...) VALUES ((SELECT last_insert_rowid()), 
cvalues...);
END;

and then probably suitable UPDATE and DELETE triggers too, presumably
mechanically generated so you don't have to keep all the column names
in sync manually.

(This is the approach I sketched out for some multitable-inheritance
ORM stuff that hasn't gotten much of anywhere yet.)

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


Re: [sqlite] Altering primary key in trigger produces incorrect last_insert_rowid() value

2010-09-06 Thread Richard Hipp
On Sun, Sep 5, 2010 at 2:57 PM, Sergey Shishmintzev <
sergey.shishmint...@gmail.com> wrote:

>
> Is it possible to tracking updates of primary key in triggers and
> returning expected last_insert_rowid()  value in future releases?
>

No.  The name is the function is last_insert_rowid(), not
last_insert_or_update_rowid().  If we changed the behavior to also trace
updates, that would break many, many existing applications that are using
the currently documented behavior.  We take backwards compatibility very
seriously.  Enhancement requests that break backwards compatibility are
non-starters.



> Or please, suggest me how to fix my code.
>

I can't figure out what it is you are trying to get your code to do.



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



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


Re: [sqlite] Create a GUI for interacting with a test questions sqlite db

2010-09-06 Thread Stef Mientki
 On 05-09-2010 10:47, Arthur Avramiea wrote:
> I would like to use sqlite to create a question db for test generation. It
> will be organized in a couple of questions cathegories. A random function
> will generate a test by selecting a couple of questions from each section.
> The sqlite db will be encrypted with http://www.zetetic.net/code/sqlcipher
> so that the users of the application without the proper credentials will not
> be able to see or modify them. 
>
> I would like to create a graphical interface which will allow me (after
> using the proper pass), to add or modify questions, that will allow the
> generation of the tests themselves,of the formatted test pages ready to be
> printed, and of a page with the answers for correction. I do not want to use
> a web interface for that, to make it more portable. It will run on Windows
> XP/Vista. 
>
> Is C++ a proper language for creating this interface? If not, which
> programming language do you recommend for the task? Which libraries should I
> use? Thank you very much. 
take a look at web2py
http://www.web2py.com/

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


Re: [sqlite] Create a GUI for interacting with a test questions sqlite db

2010-09-06 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 09/06/2010 12:21 PM, Arthur Avramiea wrote:
> The pass doesn't have to be in plain text in the software ... I
> can store it as sha1 or other kind of hash. Wouldn't that solve most of it?
> Or some implementation of SSL.

You are confusing encryption algorithms with the keys.  The decryption
runs on the client and is using a key.  A cracker can intercept that
key.  You can try and obfuscate things as much as you want, but it is
still fairly trivial for a determined cracker to get it, assuming that
is even the cheapest way of doing things.

> The software will be ran only by the course instructor so it will not have a
> big chance to get in the wrong hands. I want less exposure so that is why I
> want to avoid a web interface for it.

Another simple approach for a cracker is to bribe an instructor to hand
over credentials and database content.  Or install a USB keyboard
sniffer they won't notice.

If you have a web interface then the decryption and keys are all server
side, so at least they remain private.  That won't stop screen shots or
similar approaches but at least you won't be handing over all the
content at once.

Anyone can design a security scheme they cannot crack themselves.  That
doesn't mean it can't be cracked or that it is even any good.  Heck even
so called experts have made mistakes - for example see SSLv1 and WEP.

Roger

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkyEs4cACgkQmOOfHg372QS2EQCghyZpJXD3h3diyrD2yCRULtMg
TUYAoODS1Vk4ivT/5d7b6lsn7CCGJZYa
=3uPA
-END PGP SIGNATURE-
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Create a GUI for interacting with a test questions sqlite db

2010-09-06 Thread Amit Chaudhuri
Arthur,

Nokia's Qt4 may be worth a look.

Amit

On Mon, Sep 6, 2010 at 7:51 AM, Arthur Avramiea wrote:

>
> Thank you very much for your answers. I already have mysql, php, c and some
> beginner c++ experience. Learning a new language wouldn't be about
> difficulty, but about time :). I am also considering java for it. What do
> you think? The pass doesn't have to be in plain text in the software ... I
> can store it as sha1 or other kind of hash. Wouldn't that solve most of it?
> Or some implementation of SSL.
> The software will be ran only by the course instructor so it will not have
> a
> big chance to get in the wrong hands. I want less exposure so that is why I
> want to avoid a web interface for it.
> --
> View this message in context:
> http://old.nabble.com/Create-a-GUI-for-interacting-with-a-test-questions-sqlite-db-tp29626091p29631420.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] Create a GUI for interacting with a test questions sqlite db

2010-09-06 Thread Arthur Avramiea

Thank you very much for your answers. I already have mysql, php, c and some
beginner c++ experience. Learning a new language wouldn't be about
difficulty, but about time :). I am also considering java for it. What do
you think? The pass doesn't have to be in plain text in the software ... I
can store it as sha1 or other kind of hash. Wouldn't that solve most of it?
Or some implementation of SSL.
The software will be ran only by the course instructor so it will not have a
big chance to get in the wrong hands. I want less exposure so that is why I
want to avoid a web interface for it.
-- 
View this message in context: 
http://old.nabble.com/Create-a-GUI-for-interacting-with-a-test-questions-sqlite-db-tp29626091p29631420.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