例子:
var db = new Database('test');
if (!db.isTableExist('deg')) {
db.exeSql(`create table deg(id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, name VARCHAR(45) NULL, type DATETIME(4) NULL)`);
}
var b = db.exeSql(`insert into deg(name, type) values('afe', 11334)`);
console.log('b:' + b)
var obj = db.query('select * from deg limit 1')
console.log('obj:' + obj)
db.close();
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| dbName | string | 必填 | 数据库名 |
| 参数名 | 类型 | 必填 | 说明 |
|---|
| 参数名 | 类型 | 必填 | 说明 |
|---|
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| tableName | string | 必填 | 表名 |
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| sql | string | 必填 | sql语句 |
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| sql | string | 必填 | sql语句 |
| 参数名 | 类型 | 必填 | 说明 |
|---|
| 参数名 | 类型 | 必填 | 说明 |
|---|