- Learning SQLite for iOS
- Gene Da Rocha MSc BSc (Hons)
- 335字
- 2021-07-16 12:32:43
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.
- Vue.js 3.x快速入門
- 案例式C語言程序設計
- GeoServer Cookbook
- 微服務設計原理與架構
- Visual Basic程序設計與應用實踐教程
- Python數據結構與算法(視頻教學版)
- Android系統原理及開發要點詳解
- OpenStack Networking Essentials
- RESTful Web Clients:基于超媒體的可復用客戶端
- ActionScript 3.0從入門到精通(視頻實戰版)
- Java Hibernate Cookbook
- Python編程基礎教程
- Learn Linux Quickly
- Learning Google Apps Script
- ServiceDesk Plus 8.x Essentials