Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sqlite/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Typescript 无法访问预填充的数据库_Typescript_Sqlite_Ionic3 - Fatal编程技术网

Typescript 无法访问预填充的数据库

Typescript 无法访问预填充的数据库,typescript,sqlite,ionic3,Typescript,Sqlite,Ionic3,从我对InterWeb的研究中,我了解到在Ionic 2应用程序中允许预填充SQLite数据库;您只需将其添加到/www目录即可 我已经尝试过多次,但都没有成功。当我从预先填充的一个表中进行选择时,我会收到一个错误,表示该表不存在 My package.json设置: "dependencies": { "@angular/common": "4.0.0", "@angular/compiler": "4.0.0", "@angular/compiler-cli": "4.0.0", "@ang

从我对InterWeb的研究中,我了解到在Ionic 2应用程序中允许预填充SQLite数据库;您只需将其添加到/www目录即可

我已经尝试过多次,但都没有成功。当我从预先填充的一个表中进行选择时,我会收到一个错误,表示该表不存在

My package.json设置:

"dependencies": {
"@angular/common": "4.0.0",
"@angular/compiler": "4.0.0",
"@angular/compiler-cli": "4.0.0",
"@angular/core": "4.0.0",
"@angular/forms": "4.0.0",
"@angular/http": "4.0.0",
"@angular/platform-browser": "4.0.0",
"@angular/platform-browser-dynamic": "4.0.0",
"@ionic-native/core": "3.4.2",
"@ionic-native/splash-screen": "3.4.2",
"@ionic-native/sqlite": "^3.4.4",
"@ionic-native/status-bar": "3.4.2",
"@ionic/storage": "2.0.1",
"@types/cordova": "0.0.34",
"ionic-angular": "3.0.1",
"ionicons": "3.0.0",
"rxjs": "5.1.1",
"sw-toolbox": "3.4.0",
"zone.js": "^0.8.4"
},
"devDependencies": {
"@ionic/app-scripts": "1.3.0",
"typescript": "~2.2.1"
},
"cordovaPlugins": [
"cordova-plugin-whitelist",
"cordova-plugin-console",
"cordova-plugin-statusbar",
"cordova-plugin-device",
"ionic-plugin-keyboard",
"cordova-plugin-splashscreen"
],
"cordovaPlatforms": [],
"description": "eqm: Equipment Manager"
访问我的数据库的代码至少有一个表是:

public getPeople() {

    return new Promise((resolve, reject) => 
    this.sql.create({
        name: "eqm.db",
        location: "default"
    }).then((db2: SQLiteObject) => {
            let players = new Array<PlayerModel>();
            db2.executeSql("SELECT * FROM players", []).then((data) => {
                if(data.rows.length > 0) {
                    for(let i = 0; i < data.rows.length; i++) {
                        var model = new PlayerModel(data.rows.item(i).playerName,  data.rows.item(i).playerBarcode);
                        players.push(model);
                    }
                }
                resolve(players);

            }, (error) => {
                reject(error);

            });
    }));
}
在我的插件目录中,我注意到有: 科尔多瓦sqlite分机 科尔多瓦sqlite存储

我相信第一个是在我添加android平台时安装到这个目录的。我曾尝试过一些小的测试项目,只添加了cordova sqlite存储,但我对预填充数据库的测试没有成功


哪里出了问题?

您是否检查了sqlite db连接?代码能够找到sqlite文件吗?我建议将条件和日志设置为check@MuhammadAhsan据我所知,没有,它找不到文件。