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
是否可以使用github托管支持sqlite数据库的web应用程序?_Sqlite_Github_Github Pages - Fatal编程技术网

是否可以使用github托管支持sqlite数据库的web应用程序?

是否可以使用github托管支持sqlite数据库的web应用程序?,sqlite,github,github-pages,Sqlite,Github,Github Pages,Github支持静态网页。Sqlite数据库是一个二进制文件。具有javascript访问权限的静态网页能否对同一文件夹中的sqlite数据库进行查询 许多web开发项目都需要数据库。这仅用于演示目的,不需要支持许多用户。是,但为只读。是一个Javascript SQLite库,它将SQLite C库编译为 下面是一个例子 正如您所说,Github页面只支持静态网站。如果要进行查询,请执行服务器端代码,因为您可以更改服务器端的二进制文件。您可以手动读取数据库。 var xhr = new XML

Github支持静态网页。Sqlite数据库是一个二进制文件。具有javascript访问权限的静态网页能否对同一文件夹中的sqlite数据库进行查询

许多web开发项目都需要数据库。这仅用于演示目的,不需要支持许多用户。

是,但为只读。是一个Javascript SQLite库,它将SQLite C库编译为

下面是一个例子


正如您所说,Github页面只支持静态网站。如果要进行查询,请执行服务器端代码,因为您可以更改服务器端的二进制文件。您可以手动读取数据库。
var xhr = new XMLHttpRequest();
// For example: https://github.com/lerocha/chinook-database/raw/master/ChinookDatabase/DataSources/Chinook_Sqlite.sqlite
xhr.open('GET', '/path/to/database.sqlite', true);
xhr.responseType = 'arraybuffer';

xhr.onload = e => {
  var uInt8Array = new Uint8Array(this.response);
  var db = new SQL.Database(uInt8Array);
  var contents = db.exec("SELECT * FROM my_table");
  // contents is now [{columns:['col1','col2',...], values:[[first row], [second row], ...]}]
};
xhr.send();