官术网_书友最值得收藏!

Database connections

The sqlite3_open() C API function is used to open a connection to the database and is held in a single operating system file. This function actually opens the file, and thus, a secure connection is made that is not shared. If the memory option is used, then the database will be created in random access memory (RAM), once the connection is established. The database will then be removed and deleted from RAM when the connection closed.

SQLite will attempt to open an existing database, and if an entered database name does not exist, then it will assume that the programmer wants to create one. SQLite is clever if you want to create a database and then close it without any operation, such as creating a table: it will not actually spend resources creating the database, only an empty file will exist:

sqlite3 aFile.db "create table aTable(field1 int); drop table aTable;"

The preceding statement will create the required default file with a table and will then drop/delete it, leaving a clean database without any tables. This is possibly the neatest way to show an empty database.

When opening the SQLite database, the programmer or database administrator can specify the size of the page in different ranges from 512 to 32,768 bytes. By default, SQLite will use a 1,024 byte page size. For a better performance, the developer may consider a page size of his SQLite database equal to the operating system's page size, which will make operations much more efficient.

It all depends on the type of application you are going to design; paying attention to the detail on the type of columns, sizes, and types, which will gear a table and database design to be more efficient and perform well. If the application you are dealing with has large binary data for example, the database page size will increase to match the loading or selecting of data. The page_size parameter is used as a part of the database page sizing for each database.

主站蜘蛛池模板: 大荔县| 繁昌县| 临武县| 左权县| 双鸭山市| 仙居县| 南京市| 崇明县| 怀仁县| 都匀市| 峡江县| 黔东| 石嘴山市| 红安县| 沭阳县| 望都县| 九龙坡区| 钟山县| 枝江市| 西林县| 搜索| 祁阳县| 广东省| 哈密市| 瓦房店市| 新邵县| 金乡县| 龙口市| 宜阳县| 合江县| 三亚市| 肇庆市| 广平县| 河池市| 醴陵市| 瑞昌市| 临沂市| 白城市| 常山县| 绥棱县| 墨江|