import Expo, { SQLite } from 'expo';
const db = SQLite.openDatabase('db.db');
export function create(){
db.transaction(tx => {
tx.executeSql(
'CREATE TABLE if not exists material_mg (ID INT PRIMARY KEY ,order_number VARCHAR(10) ,truck_number VARCHAR(10) ,enter_mine_date TEXT ,vehicle_owner_name VARCHAR(50) ,driver_address TEXT ,driver_mobile_number BIGINT ,weigh_bridge FLOAT,in_time TEXT ,out_time TEXT ,drop_off_point TEXT ,transporter_name VARCHAR(50) ,loaded_from VARCHAR(50) ,mines_name VARCHAR(50) ,material VARCHAR(20) ,total_number_of_seats SMALLINT ,loading_in_timestamp TEXT,loading_out_timestamp TEXT,unloading_company_name VARCHAR(50) ,unloading_company_address VARCHAR(100),type_of_trip VARCHAR(5) ,loading_supervisor_name VARCHAR(50) ,weight FLOAT ,challan_date TEXT,challan_number VARCHAR(10) ,t_h CHAR ,party_name VARCHAR(50) ,sil_number VARCHAR(10) ,diesel INT,advance INT,booking_name VARCHAR(50) ,colliery_name VARCHAR(50) ,lifter_name VARCHAR(50) ,coalnet_weight FLOAT ,gross_weight FLOAT ,tare_weight FLOAT ,net_weight FLOAT ,remarks TEXT ,ccl_bill_number INT ,cash INT ,destination VARCHAR(50) ,broker_name VARCHAR(50) ,broker_mobile_number BIGINT )',null,(tx,resultset)=>{console.log(resultset)},(tx,resultset)=>{console.log(resultset)}
);
});
}
上面的代码是我的数据库文件。当我执行此创建查询时,我得到attempt to write a readonly database (code 1032)
错误。我正在使用带有React Native的expo客户端。不确定在何处配置访问控制。也无法在expo sqlite文档中找到任何内容。任何帮助表示赞赏。提到的其他解决方案并不适用于此,因为我使用的是CRNA方法。
答案 0 :(得分:0)
删除或重命名数据库文件时可能会发生这种情况。 请参阅1032错误代码说明-https://www.sqlite.org/rescode.html#readonly_dbmoved