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
Javascript 数据库语句在google chrome中不起作用_Javascript_Sqlite_Google Chrome_Opendatabase - Fatal编程技术网

Javascript 数据库语句在google chrome中不起作用

Javascript 数据库语句在google chrome中不起作用,javascript,sqlite,google-chrome,opendatabase,Javascript,Sqlite,Google Chrome,Opendatabase,我正在运行chrome43.0。在控制台中,我运行以下命令: >> var db1 = openDatabase('testDB', '', 'my first database', 2 * 1024 * 1024, function(d){console.log(d);}); >> undefined >> db1.transaction(function (tx) { console.log(".............

我正在运行chrome
43.0
。在控制台中,我运行以下命令:

  >>  var db1 = openDatabase('testDB', '', 'my first database', 2 * 1024 * 1024, function(d){console.log(d);});

  >>  undefined

  >>  db1.transaction(function (tx) { 
      console.log("....................."); 
      console.log(tx.executeSql("INSERT INTO fileLog (fileName, bucketName) VALUES ('123','synergies')"));
    });

  >>  undefined
     .....................
      undefined

问题在于没有在
fileLog
表中插入任何数据。

必须先创建表fileLog,然后才能将值插入其中,如下所示:

db1.transaction(function (tx) { 
tx.executeSql('CREATE TABLE IF NOT EXISTS fileLog (fileName,bucketName )');    });
您可以从中选择值作为

db1.transaction(function (tx) { 
      tx.executeSql('SELECT * FROM fileLog ', [], function (tx, results) {
     for (var i = 0; i < results.rows.length; i++){
         console.log(results.rows.item(i).fileName," ",results.rows.item(i).bucketName);
      }

   }, null);
    });
db1.事务(函数(tx){
tx.executeSql('SELECT*FROM fileLog',[],函数(tx,results){
对于(var i=0;i
问题在于没有错误回调。