table:conf['type']==='oracle'?`SELECT * FROM (SELECT A.*,ROWNUM N FROM ${table} A) WHERE N=1`:`USE [${this.dbconf['database']}];SELECT TOP 0 * FROM ${table}`
table:sql
})
).then((res)=>{
letret=res['text'];
if(ret.indexOf("ERROR://")>-1){
throwret;
}
constarr=ret.split('\t');
const_db=newBuffer(db).toString('base64');
const_table=newBuffer(table).toString('base64');
...
...
@@ -526,11 +555,20 @@ class ASP {
this.manager.list.imgs[3]
);
});
letpresql="";
switch(this.dbconf['type']){
case'mysql':
presql=`SELECT * FROM \`${table}\` ORDER BY 1 DESC LIMIT 0,20;`;
break;
case'oracle':
presql=`SELECT * FROM ${db}.${table} WHERE ROWNUM < 20 ORDER BY 1`;
break;
default:
presql=`SELECT TOP 20 * from [${table}] ORDER BY 1 DESC;`;
break;
}
// 更新编辑器SQL语句
this.manager.query.editor.session.setValue(
conf['type']==='oracle'
?`SELECT * FROM (SELECT A.*,ROWNUM N FROM ${table} A ORDER BY 1 DESC) WHERE N>0 AND N<=20`
:`SELECT TOP 20 * FROM ${table} ORDER BY 1 DESC;`);