import {EditorContext,EditorParser,CodeCompletionRequest} from "."


//手动测试类

function selectTest1() {
    console.log("当前selectTest1：");
    let context = new EditorContext();
    context.cpId = 1;
    context.dataBaseName = "employees";
    context.editorType = "sql";
    context.command = "select a from c";
    context.rangeOffset = 7;
    context.currentChar = "a";
    context.dataSourceName = "MYSQL";


    let parseResult = EditorParser.parse(context);
    console.log("测试结果：");
    console.log(parseResult);

}

function selectTest2() {
    console.log("当前selectTest1：");
    let context = new EditorContext();
    context.cpId = 1;
    context.dataBaseName = "employees";
    context.editorType = "sql";
    context.command = "select a";
    context.rangeOffset = 7;
    context.currentChar = "a";
    context.dataSourceName = "MYSQL";


    let parseResult = EditorParser.parse(context);
    console.log("测试结果：");
    console.log(parseResult);

}

function insertTest(){
    console.log("当前insertTest：");
    let context = new EditorContext();
    context.cpId = 1;
    context.dataBaseName = "world";
    context.editorType = "sql";
    context.command = "insert into c(ID,Name) values(1,2)";
    context.rangeOffset = 12;
    context.currentChar = "c";
    context.dataSourceName = "MYSQL";



    let parser = new EditorParser();
    let completionRequest = EditorParser.parse(context);
    if (completionRequest == undefined){
        console.log("补全类型为undefined")
    }else {
        console.log(completionRequest)
    }


}

function updateTest(){
    console.log("当前updateTest：");
    let context = new EditorContext();
    context.cpId = 1;
    context.dataBaseName = "world";
    context.editorType = "sql";
    context.command = "UPDATE city SET N=(SELECT Name FROM country WHERE ID=30) WHERE ID=10";
    context.rangeOffset = 16;
    context.currentChar = "N";
    context.dataSourceName = "MYSQL";



    let parser = new EditorParser();
    let completionRequest = EditorParser.parse(context);
    if (completionRequest == undefined){
        console.log("补全类型为undefined")
    }else {
        console.log(completionRequest)
    }


}

function deleteTest(){
    console.log("当前insertTest：");
    let context = new EditorContext();
    context.cpId = 1;
    context.dataBaseName = "world";
    context.editorType = "sql";
    context.command = "DELETE FROM c";
    context.rangeOffset = 12;
    context.currentChar = "c";
    context.dataSourceName = "MYSQL";



    let parser = new EditorParser();
    let completionRequest = EditorParser.parse(context);
    if (completionRequest == undefined){
        console.log("补全类型为undefined")
    }else {
        console.log(completionRequest)
    }


}




selectTest1();
selectTest2();
// insertTest();
// updateTest();
// deleteTest();