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