Re: [sqlite] Create database

2017-04-14 Thread Daniel Anderson
http://lmgtfy.com/?q=sqlite+c%2B%2B+wrapper

2017-04-15 0:05 GMT-04:00 Keith Medcalf <kmedc...@dessus.com>:

>
> What existing one?  SQLite3 is written in C ...
>
> --
> ˙uʍop-ǝpısdn sı ɹoʇıuoɯ ɹnoʎ 'sıɥʇ pɐǝɹ uɐɔ noʎ ɟı
>
> > -Original Message-
> > From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org]
> > On Behalf Of Daniel Anderson
> > Sent: Friday, 14 April, 2017 21:11
> > To: SQLite mailing list
> > Subject: Re: [sqlite] Create database
> >
> > you would probably be better off using C++ to handle everything, less
> > chances of forgetting to close something.
> >
> > do not build your own classes, use existing one!
> >
> > 2017-04-14 10:44 GMT-04:00 Igor Korot <ikoro...@gmail.com>:
> >
> > > Keith,
> > >
> > > On Fri, Apr 14, 2017 at 10:37 AM, Keith Medcalf <kmedc...@dessus.com>
> > > wrote:
> > > >
> > > > To further clarify, the result of doing multiple sqlite3_open calls
> > and
> > > saving the results to the save db handle is the same as doing
> > > >
> > > > fh = fopen(...)
> > > > fh = fopen(...)
> > > > fh = fopen(...)
> > > >
> > > > You have opened multiple files but are only keeping track of 1.  So
> > > although three files are opened fclose(fh) will only close the last
> one,
> > > and the first two are still open, you just discarded your reference to
> > them
> > > and they are inaccessible to you.
> > > >
> > > > If you do this sort of thing a lot then you program will eventually
> > > crash when it fills up with unreferenced (leaked) memory objects that
> > you
> > > forgot (and have overwritten the handle) to close.
> > >
> > > Thank you for clarifying.
> > > It means that the call to sqlite3_open() does not close previously
> > > opened database and I have to explicitly close it
> > > with sqlite3_close().
> > >
> > > I was just couldn't find it anywhere in the docs. Probably missed it.
> > >
> > > >
> > > > --
> > > > ˙uʍop-ǝpısdn sı ɹoʇıuoɯ ɹnoʎ 'sıɥʇ pɐǝɹ uɐɔ noʎ ɟı
> > > >
> > > >
> > > >> -Original Message-
> > > >> From: sqlite-users [mailto:sqlite-users-
> > boun...@mailinglists.sqlite.org
> > > ]
> > > >> On Behalf Of Keith Medcalf
> > > >> Sent: Friday, 14 April, 2017 08:32
> > > >> To: SQLite mailing list
> > > >> Subject: Re: [sqlite] Create database
> > > >>
> > > >>
> > > >> No, a new database will be opened and you will be given an sqlite3*
> > to
> > > it.
> > > >>
> > > >> Just like the fopen() call can be used to open multiple files,
> > > >> sqlite3_open* opens a database.  The way to close an sqlite3*
> (handle
> > to
> > > >> a) database is to use sqlite3_close specifying the database you want
> > to
> > > >> close.
> > > >>
> > > >> --
> > > >> ˙uʍop-ǝpısdn sı ɹoʇıuoɯ ɹnoʎ 'sıɥʇ pɐǝɹ uɐɔ noʎ ɟı
> > > >>
> > > >>
> > > >> > -Original Message-
> > > >> > From: sqlite-users [mailto:sqlite-users-bounces@
> > > mailinglists.sqlite.org]
> > > >> > On Behalf Of Igor Korot
> > > >> > Sent: Friday, 14 April, 2017 08:26
> > > >> > To: Discussion of SQLite Database; General Discussion of SQLite
> > > Database
> > > >> > Subject: [sqlite] Create database
> > > >> >
> > > >> >  Hi,
> > > >> > If I have a database open with sqlite3_open() and then want to
> > issue
> > > >> > another sqlite3_open(),
> > > >> > the old database will be closed and the new one will open?
> > > >> > Or I have to explicitly call sqlite3_close()?
> > > >> >
> > > >> > Thank you.
> > > >> > ___
> > > >> > sqlite-users mailing list
> > > >> > sqlite-users@mailinglists.sqlite.org
> > > >> > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-
> > users
> > > >>
> > > >>
> > > >>
> > > >> ___
> > > >> sqlite-users mailing list
> > > >

Re: [sqlite] Create database

2017-04-14 Thread Keith Medcalf

What existing one?  SQLite3 is written in C ...

-- 
˙uʍop-ǝpısdn sı ɹoʇıuoɯ ɹnoʎ 'sıɥʇ pɐǝɹ uɐɔ noʎ ɟı

> -Original Message-
> From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org]
> On Behalf Of Daniel Anderson
> Sent: Friday, 14 April, 2017 21:11
> To: SQLite mailing list
> Subject: Re: [sqlite] Create database
> 
> you would probably be better off using C++ to handle everything, less
> chances of forgetting to close something.
> 
> do not build your own classes, use existing one!
> 
> 2017-04-14 10:44 GMT-04:00 Igor Korot <ikoro...@gmail.com>:
> 
> > Keith,
> >
> > On Fri, Apr 14, 2017 at 10:37 AM, Keith Medcalf <kmedc...@dessus.com>
> > wrote:
> > >
> > > To further clarify, the result of doing multiple sqlite3_open calls
> and
> > saving the results to the save db handle is the same as doing
> > >
> > > fh = fopen(...)
> > > fh = fopen(...)
> > > fh = fopen(...)
> > >
> > > You have opened multiple files but are only keeping track of 1.  So
> > although three files are opened fclose(fh) will only close the last one,
> > and the first two are still open, you just discarded your reference to
> them
> > and they are inaccessible to you.
> > >
> > > If you do this sort of thing a lot then you program will eventually
> > crash when it fills up with unreferenced (leaked) memory objects that
> you
> > forgot (and have overwritten the handle) to close.
> >
> > Thank you for clarifying.
> > It means that the call to sqlite3_open() does not close previously
> > opened database and I have to explicitly close it
> > with sqlite3_close().
> >
> > I was just couldn't find it anywhere in the docs. Probably missed it.
> >
> > >
> > > --
> > > ˙uʍop-ǝpısdn sı ɹoʇıuoɯ ɹnoʎ 'sıɥʇ pɐǝɹ uɐɔ noʎ ɟı
> > >
> > >
> > >> -Original Message-
> > >> From: sqlite-users [mailto:sqlite-users-
> boun...@mailinglists.sqlite.org
> > ]
> > >> On Behalf Of Keith Medcalf
> > >> Sent: Friday, 14 April, 2017 08:32
> > >> To: SQLite mailing list
> > >> Subject: Re: [sqlite] Create database
> > >>
> > >>
> > >> No, a new database will be opened and you will be given an sqlite3*
> to
> > it.
> > >>
> > >> Just like the fopen() call can be used to open multiple files,
> > >> sqlite3_open* opens a database.  The way to close an sqlite3* (handle
> to
> > >> a) database is to use sqlite3_close specifying the database you want
> to
> > >> close.
> > >>
> > >> --
> > >> ˙uʍop-ǝpısdn sı ɹoʇıuoɯ ɹnoʎ 'sıɥʇ pɐǝɹ uɐɔ noʎ ɟı
> > >>
> > >>
> > >> > -Original Message-
> > >> > From: sqlite-users [mailto:sqlite-users-bounces@
> > mailinglists.sqlite.org]
> > >> > On Behalf Of Igor Korot
> > >> > Sent: Friday, 14 April, 2017 08:26
> > >> > To: Discussion of SQLite Database; General Discussion of SQLite
> > Database
> > >> > Subject: [sqlite] Create database
> > >> >
> > >> >  Hi,
> > >> > If I have a database open with sqlite3_open() and then want to
> issue
> > >> > another sqlite3_open(),
> > >> > the old database will be closed and the new one will open?
> > >> > Or I have to explicitly call sqlite3_close()?
> > >> >
> > >> > Thank you.
> > >> > ___
> > >> > sqlite-users mailing list
> > >> > sqlite-users@mailinglists.sqlite.org
> > >> > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-
> users
> > >>
> > >>
> > >>
> > >> ___
> > >> sqlite-users mailing list
> > >> sqlite-users@mailinglists.sqlite.org
> > >> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> > >
> > >
> > >
> > > ___
> > > sqlite-users mailing list
> > > sqlite-users@mailinglists.sqlite.org
> > > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> > ___
> > sqlite-users mailing list
> > sqlite-users@mailinglists.sqlite.org
> > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> >
> 
> 
> 
> --
> Daniel
> *L'action accède à la perfection quand, bien que vivant, vous êtes déjà
> mort*
> *Bunan*
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



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


Re: [sqlite] Create database

2017-04-14 Thread Daniel Anderson
you would probably be better off using C++ to handle everything, less
chances of forgetting to close something.

do not build your own classes, use existing one!

2017-04-14 10:44 GMT-04:00 Igor Korot <ikoro...@gmail.com>:

> Keith,
>
> On Fri, Apr 14, 2017 at 10:37 AM, Keith Medcalf <kmedc...@dessus.com>
> wrote:
> >
> > To further clarify, the result of doing multiple sqlite3_open calls and
> saving the results to the save db handle is the same as doing
> >
> > fh = fopen(...)
> > fh = fopen(...)
> > fh = fopen(...)
> >
> > You have opened multiple files but are only keeping track of 1.  So
> although three files are opened fclose(fh) will only close the last one,
> and the first two are still open, you just discarded your reference to them
> and they are inaccessible to you.
> >
> > If you do this sort of thing a lot then you program will eventually
> crash when it fills up with unreferenced (leaked) memory objects that you
> forgot (and have overwritten the handle) to close.
>
> Thank you for clarifying.
> It means that the call to sqlite3_open() does not close previously
> opened database and I have to explicitly close it
> with sqlite3_close().
>
> I was just couldn't find it anywhere in the docs. Probably missed it.
>
> >
> > --
> > ˙uʍop-ǝpısdn sı ɹoʇıuoɯ ɹnoʎ 'sıɥʇ pɐǝɹ uɐɔ noʎ ɟı
> >
> >
> >> -Original Message-
> >> From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org
> ]
> >> On Behalf Of Keith Medcalf
> >> Sent: Friday, 14 April, 2017 08:32
> >> To: SQLite mailing list
> >> Subject: Re: [sqlite] Create database
> >>
> >>
> >> No, a new database will be opened and you will be given an sqlite3* to
> it.
> >>
> >> Just like the fopen() call can be used to open multiple files,
> >> sqlite3_open* opens a database.  The way to close an sqlite3* (handle to
> >> a) database is to use sqlite3_close specifying the database you want to
> >> close.
> >>
> >> --
> >> ˙uʍop-ǝpısdn sı ɹoʇıuoɯ ɹnoʎ 'sıɥʇ pɐǝɹ uɐɔ noʎ ɟı
> >>
> >>
> >> > -Original Message-
> >> > From: sqlite-users [mailto:sqlite-users-bounces@
> mailinglists.sqlite.org]
> >> > On Behalf Of Igor Korot
> >> > Sent: Friday, 14 April, 2017 08:26
> >> > To: Discussion of SQLite Database; General Discussion of SQLite
> Database
> >> > Subject: [sqlite] Create database
> >> >
> >> >  Hi,
> >> > If I have a database open with sqlite3_open() and then want to issue
> >> > another sqlite3_open(),
> >> > the old database will be closed and the new one will open?
> >> > Or I have to explicitly call sqlite3_close()?
> >> >
> >> > Thank you.
> >> > ___
> >> > sqlite-users mailing list
> >> > sqlite-users@mailinglists.sqlite.org
> >> > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> >>
> >>
> >>
> >> ___
> >> sqlite-users mailing list
> >> sqlite-users@mailinglists.sqlite.org
> >> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> >
> >
> >
> > ___
> > sqlite-users mailing list
> > sqlite-users@mailinglists.sqlite.org
> > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
Daniel
*L'action accède à la perfection quand, bien que vivant, vous êtes déjà
mort*
*Bunan*
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Create database

2017-04-14 Thread Jens Alfke

> On Apr 14, 2017, at 7:44 AM, Igor Korot  wrote:
> 
> It means that the call to sqlite3_open() does not close previously
> opened database and I have to explicitly close it
> with sqlite3_close().
> 
> I was just couldn't find it anywhere in the docs. Probably missed it.

The handle is documented as an ‘out’ parameter to sqlite3_open, so the function 
simply ignores any value it has on input (it’s probably uninitialized garbage 
anyway.) All it does is store the new handle there.

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


Re: [sqlite] Create database

2017-04-14 Thread Simon Slavin

On 14 Apr 2017, at 3:44pm, Igor Korot  wrote:

> Thank you for clarifying.
> It means that the call to sqlite3_open() does not close previously
> opened database and I have to explicitly close it
> with sqlite3_close().

SQLite can open as many connections as you want.  It hands you back a handle 
for each one.  If you want it to close one, you have to tell it which one you 
want it to close.

So don’t do this:

sqlite3 *m_db;
int res = sqlite3_open( name1, _db );
//some database operations
res = sqlite3_open( name2, _db );
// stuff goes here
res = sqlite3_close(m_db);

do this:

sqlite3 *m_db;
int res = sqlite3_open( name1, _db );
//some database operations
res = sqlite3_close(m_db);
res = sqlite3_open( name2, _db );
// stuff goes here
res = sqlite3_close(m_db);

or this:

sqlite3 *m_db1;
sqlite3 *m_db2;
int res = sqlite3_open( name1, _db1 );
//some database operations
res = sqlite3_open( name2, _db2 );
// now they’re both open
// stuff goes here
res = sqlite3_close(m_db2);
// check result to see it closed okay
res = sqlite3_close(m_db1);
// check result to see it closed okay

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


Re: [sqlite] Create database

2017-04-14 Thread Igor Korot
Keith,

On Fri, Apr 14, 2017 at 10:37 AM, Keith Medcalf <kmedc...@dessus.com> wrote:
>
> To further clarify, the result of doing multiple sqlite3_open calls and 
> saving the results to the save db handle is the same as doing
>
> fh = fopen(...)
> fh = fopen(...)
> fh = fopen(...)
>
> You have opened multiple files but are only keeping track of 1.  So although 
> three files are opened fclose(fh) will only close the last one, and the first 
> two are still open, you just discarded your reference to them and they are 
> inaccessible to you.
>
> If you do this sort of thing a lot then you program will eventually crash 
> when it fills up with unreferenced (leaked) memory objects that you forgot 
> (and have overwritten the handle) to close.

Thank you for clarifying.
It means that the call to sqlite3_open() does not close previously
opened database and I have to explicitly close it
with sqlite3_close().

I was just couldn't find it anywhere in the docs. Probably missed it.

>
> --
> ˙uʍop-ǝpısdn sı ɹoʇıuoɯ ɹnoʎ 'sıɥʇ pɐǝɹ uɐɔ noʎ ɟı
>
>
>> -Original Message-
>> From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org]
>> On Behalf Of Keith Medcalf
>> Sent: Friday, 14 April, 2017 08:32
>> To: SQLite mailing list
>> Subject: Re: [sqlite] Create database
>>
>>
>> No, a new database will be opened and you will be given an sqlite3* to it.
>>
>> Just like the fopen() call can be used to open multiple files,
>> sqlite3_open* opens a database.  The way to close an sqlite3* (handle to
>> a) database is to use sqlite3_close specifying the database you want to
>> close.
>>
>> --
>> ˙uʍop-ǝpısdn sı ɹoʇıuoɯ ɹnoʎ 'sıɥʇ pɐǝɹ uɐɔ noʎ ɟı
>>
>>
>> > -Original Message-
>> > From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org]
>> > On Behalf Of Igor Korot
>> > Sent: Friday, 14 April, 2017 08:26
>> > To: Discussion of SQLite Database; General Discussion of SQLite Database
>> > Subject: [sqlite] Create database
>> >
>> >  Hi,
>> > If I have a database open with sqlite3_open() and then want to issue
>> > another sqlite3_open(),
>> > the old database will be closed and the new one will open?
>> > Or I have to explicitly call sqlite3_close()?
>> >
>> > Thank you.
>> > ___
>> > sqlite-users mailing list
>> > sqlite-users@mailinglists.sqlite.org
>> > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>>
>>
>>
>> ___
>> sqlite-users mailing list
>> sqlite-users@mailinglists.sqlite.org
>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
>
>
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Create database

2017-04-14 Thread Keith Medcalf

To further clarify, the result of doing multiple sqlite3_open calls and saving 
the results to the save db handle is the same as doing

fh = fopen(...)
fh = fopen(...)
fh = fopen(...)

You have opened multiple files but are only keeping track of 1.  So although 
three files are opened fclose(fh) will only close the last one, and the first 
two are still open, you just discarded your reference to them and they are 
inaccessible to you.

If you do this sort of thing a lot then you program will eventually crash when 
it fills up with unreferenced (leaked) memory objects that you forgot (and have 
overwritten the handle) to close.

-- 
˙uʍop-ǝpısdn sı ɹoʇıuoɯ ɹnoʎ 'sıɥʇ pɐǝɹ uɐɔ noʎ ɟı


> -Original Message-
> From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org]
> On Behalf Of Keith Medcalf
> Sent: Friday, 14 April, 2017 08:32
> To: SQLite mailing list
> Subject: Re: [sqlite] Create database
> 
> 
> No, a new database will be opened and you will be given an sqlite3* to it.
> 
> Just like the fopen() call can be used to open multiple files,
> sqlite3_open* opens a database.  The way to close an sqlite3* (handle to
> a) database is to use sqlite3_close specifying the database you want to
> close.
> 
> --
> ˙uʍop-ǝpısdn sı ɹoʇıuoɯ ɹnoʎ 'sıɥʇ pɐǝɹ uɐɔ noʎ ɟı
> 
> 
> > -Original Message-
> > From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org]
> > On Behalf Of Igor Korot
> > Sent: Friday, 14 April, 2017 08:26
> > To: Discussion of SQLite Database; General Discussion of SQLite Database
> > Subject: [sqlite] Create database
> >
> >  Hi,
> > If I have a database open with sqlite3_open() and then want to issue
> > another sqlite3_open(),
> > the old database will be closed and the new one will open?
> > Or I have to explicitly call sqlite3_close()?
> >
> > Thank you.
> > ___
> > sqlite-users mailing list
> > sqlite-users@mailinglists.sqlite.org
> > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> 
> 
> 
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



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


Re: [sqlite] Create database

2017-04-14 Thread Igor Korot
Keith,

On Fri, Apr 14, 2017 at 10:32 AM, Keith Medcalf  wrote:
>
> No, a new database will be opened and you will be given an sqlite3* to it.
>
> Just like the fopen() call can be used to open multiple files, sqlite3_open* 
> opens a database.  The way to close an sqlite3* (handle to a) database is to 
> use sqlite3_close specifying the database you want to close.

I'm talking about using same database handle for both calls.

Something like this:

[pseudo-code]
sqlite3 *m_db;
int res = sqlite3_open( name1, _db );
//some database operations
res = sqlite3_open( name2, _db );
[/pseudo-code]

Thank you.

>
> --
> ˙uʍop-ǝpısdn sı ɹoʇıuoɯ ɹnoʎ 'sıɥʇ pɐǝɹ uɐɔ noʎ ɟı
>
>
>> -Original Message-
>> From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org]
>> On Behalf Of Igor Korot
>> Sent: Friday, 14 April, 2017 08:26
>> To: Discussion of SQLite Database; General Discussion of SQLite Database
>> Subject: [sqlite] Create database
>>
>>  Hi,
>> If I have a database open with sqlite3_open() and then want to issue
>> another sqlite3_open(),
>> the old database will be closed and the new one will open?
>> Or I have to explicitly call sqlite3_close()?
>>
>> Thank you.
>> ___
>> sqlite-users mailing list
>> sqlite-users@mailinglists.sqlite.org
>> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
>
>
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] Create database

2017-04-14 Thread Keith Medcalf

No, a new database will be opened and you will be given an sqlite3* to it.

Just like the fopen() call can be used to open multiple files, sqlite3_open* 
opens a database.  The way to close an sqlite3* (handle to a) database is to 
use sqlite3_close specifying the database you want to close.

-- 
˙uʍop-ǝpısdn sı ɹoʇıuoɯ ɹnoʎ 'sıɥʇ pɐǝɹ uɐɔ noʎ ɟı


> -Original Message-
> From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org]
> On Behalf Of Igor Korot
> Sent: Friday, 14 April, 2017 08:26
> To: Discussion of SQLite Database; General Discussion of SQLite Database
> Subject: [sqlite] Create database
> 
>  Hi,
> If I have a database open with sqlite3_open() and then want to issue
> another sqlite3_open(),
> the old database will be closed and the new one will open?
> Or I have to explicitly call sqlite3_close()?
> 
> Thank you.
> ___
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



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


Re: [sqlite] create database file at runtime

2005-09-14 Thread Nemanja Corlija
On 9/14/05, Mark Wyszomierski <[EMAIL PROTECTED]> wrote:
> Hi everyone,
>  Two quick questions:
>  1) Is there anything special the supplied sqlite3.exe does to create a
> database file. I want to programatically create a database file at runtime,
> so can I just create an empty xxx.db file, and go ahead with create table
> statements to populate it? The documentation says to create a sqlite
> database you should use the supplied app (sqlite3.exe). Is just doing that
> myself ok?
See http://www.sqlite.org/capi3ref.html#sqlite3_open
If you're not using C API directly, look up the docs for your wrapper,
but in general db file should be created for you when you call
"open()" method of your wrapper with filename that doesn't exist yet.

>  2) While creating tables, I've been specifying the data type after the
> field name:
>   create table test(field_1 integer, field_2 text);
>  The only advantage of this is that the database could possible store the
> data in a more compact form, correct? If that's not a concern, leaving it
> all as text would not make a difference?
Data type affinity is used at runtime too (comparison for example).
See http://www.sqlite.org/datatype3.html for more details.


-- 
Nemanja Corlija <[EMAIL PROTECTED]>


RE: [sqlite] create database API

2005-01-17 Thread Fred Williams
Don't worry.  It was a trick question :-)

-Original Message-
From: bs [mailto:[EMAIL PROTECTED]
Sent: Monday, January 17, 2005 1:19 PM
To: sqlite-users@sqlite.org
Subject: Re: [sqlite] create database API


Ulrik Petersen wrote:
> Hi there,
> 
> bs wrote:
> 
>> if (NULL == (db = sqlite_open(argv[0], 0, ))) {
> 
> 
> argv[0] is the name of the program, which is not a database.   You 
> probably want argv[1].
> 
pls hit me with a big stick!

thx!
bal




Re: [sqlite] create database API

2005-01-17 Thread bs
Ulrik Petersen wrote:
Hi there,
bs wrote:
if (NULL == (db = sqlite_open(argv[0], 0, ))) {

argv[0] is the name of the program, which is not a database.   You 
probably want argv[1].

pls hit me with a big stick!
thx!
bal


Re: [sqlite] create database API

2005-01-17 Thread Kurt Welgehausen
What does argv[0] point to?

Regards