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

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.

主站蜘蛛池模板: 古交市| 二连浩特市| 剑河县| 全椒县| 叶城县| 张家口市| 营口市| 太仆寺旗| 邳州市| 宜丰县| 黄浦区| 延寿县| 满洲里市| 社会| 加查县| 炉霍县| 始兴县| 青岛市| 阜平县| 宁南县| 东明县| 宝应县| 苗栗市| 洛阳市| 镇原县| 宜昌市| 昆山市| 定结县| 加查县| 商河县| 阿荣旗| 营山县| 鄯善县| 丰台区| 休宁县| 正宁县| 陈巴尔虎旗| 盐源县| 宜川县| 卢湾区| 石台县|