TC官方合作论坛

标题: 大龙最新数据库插件,通用所用类型,格式统一,不需要..... [打印本页]

作者: ciiny2017    时间: 2017-10-15 01:25
标题: 大龙最新数据库插件,通用所用类型,格式统一,不需要.....
数据库全平台统一格式,方便统一书写,任何数据库都可以使用了,全部都整合到一起了,高效快速。以下以按键调用例子为例,写法都差不多
Plugin.DL.ConnectMyDB("MySQL", "用户名", "密码", "服务器IP", "数据库名字", 端口)
例如:
Plugin.DL.ConnectMyDB("MySQL", "root", "1234560", "localhost", "studb", 3306)
Plugin.DL.ConnectMyDB("SQLite", "", "", "", "D:\test.db", 0)
Plugin.DL.ConnectMyDB("SQL Server", "admin", "123456", "202.102.11.252", "datebase", 1433)
Plugin.DL.ConnectMyDB("SQLite", "", "", "", "D:\test.db", 0)
Plugin.DL.ConnectMyDB("Access", "", "", "localhost", "D:\my.accdb", 0)
Plugin.DL.ConnectMyDB("Oracle", "账号", "密码", "localhost", "", 0)
看到没所有数据库都支持,很方便的,书写格式都一致!!!
-------------------------------------------------------------------------------------------------------------
实战代码
//按键插件调用方式 MySQL
ret = Plugin.DL.ConnectMyDB("MySQL", "root", "1234560", "localhost", "studb", 3306)
If ret =1 Then
       s = Plugin.DL.GetTable("SELECT * FROM 本地学员 limit 0,10 ")
       MessageBox s
       //s = Plugin.DL.InsertSQL("insert into 本地学员(stuname) values(1)")
       //MessageBox s        
       //s = Plugin.DL.UpdateSQL("update 本地学员 set stuname ='givl' where id = 1")
       //MessageBox s
      // s = Plugin.DL.DeleteSQL("delete from 本地学员 where id = 1")
       //MessageBox s
       //s = Plugin.DL.ExecSQL("insert into 本地学员 VALUES('1','1','2','3','1','2')")
       //MessageBox s
       ret = Plugin.DL.CloseMyDB  
    Else
  MessageBox ret            
End If


//按键插件调用方式 SQL Server
ret = Plugin.DL.ConnectMyDB("SQL Server", "admin", "123456", "202.102.11.252", "datebase", 1433)

If ret =1 Then
       s = Plugin.DL.GetTable("SELECT top 10 * FROM whsw  ")
       MessageBox s
       //s = Plugin.DL.InsertSQL("insert into 本地学员(stuname) values(1)")
       //MessageBox s        
       //s = Plugin.DL.UpdateSQL("update 本地学员 set stuname ='givl' where id = 1")
       //MessageBox s
      // s = Plugin.DL.DeleteSQL("delete from 本地学员 where id = 1")
       //MessageBox s
       //s = Plugin.DL.ExecSQL("insert into 本地学员 VALUES('1','1','2','3','1','2')")
       //MessageBox s
       ret = Plugin.DL.CloseMyDB  
    Else
  MessageBox ret            
End If

//按键插件调用方式 SQLite
ret = Plugin.DL.ConnectMyDB("SQLite", "", "", "", "D:\test.db", 0)
If ret =1 Then
       s = Plugin.DL.GetTable("SELECT * FROM people limit 0,10  ")
       MessageBox s
       //s = Plugin.DL.InsertSQL("insert into people(myname) values(1)")
       //MessageBox s        
       //s = Plugin.DL.UpdateSQL("update people set myname ='givl2' where id = 3")
       //MessageBox s
       //s = Plugin.DL.DeleteSQL("delete from people where id = 3")
       //MessageBox s
       //s = Plugin.DL.ExecSQL("insert into people VALUES('1','1','2','3','1','2')")
       //MessageBox s
       ret = Plugin.DL.CloseMyDB  
    Else
  MessageBox ret            
End If

//按键插件调用方式 Access
ret = Plugin.DL.ConnectMyDB("Access", "", "", "localhost", "D:\my.accdb", 0)
If ret =1 Then
       s = Plugin.DL.GetTable("SELECT top 10 * FROM people ")
       MessageBox s
       //s = Plugin.DL.InsertSQL("insert into 本地学员(stuname) values(1)")
       //MessageBox s        
       //s = Plugin.DL.UpdateSQL("update 本地学员 set stuname ='givl' where id = 1")
       //MessageBox s
      // s = Plugin.DL.DeleteSQL("delete from 本地学员 where id = 1")
       //MessageBox s
       //s = Plugin.DL.ExecSQL("insert into 本地学员 VALUES('1','1','2','3','1','2')")
       //MessageBox s
       ret = Plugin.DL.CloseMyDB  
    Else
  MessageBox ret            
End If

//按键插件调用方式 Oracle
ret = Plugin.DL.ConnectMyDB("Oracle", "账号", "密码", "localhost", "", 0)
If ret =1 Then
       s = Plugin.DL.GetTable("SELECT top 10 * FROM people ")
       MessageBox s
       //s = Plugin.DL.InsertSQL("insert into 本地学员(stuname) values(1)")
       //MessageBox s        
       //s = Plugin.DL.UpdateSQL("update 本地学员 set stuname ='givl' where id = 1")
       //MessageBox s
      // s = Plugin.DL.DeleteSQL("delete from 本地学员 where id = 1")
       //MessageBox s
       //s = Plugin.DL.ExecSQL("insert into 本地学员 VALUES('1','1','2','3','1','2')")
       //MessageBox s
       ret = Plugin.DL.CloseMyDB  
    Else
  MessageBox ret            
End If



网盘地址
h ttps://pan.baidu.com/s/1cpUMke
QQ技术群:621816328




作者: ciiny2017    时间: 2017-10-15 01:27
插件采用VC 和 Delphi编写,部分采用汇编,算法效率极高!
作者: ciiny2017    时间: 2017-10-15 17:26
TC调用方式
function button0_click()
        var path=sysgetcurrentpath()       
                //messagebox(FilePath)
        var DL=com("DL.DLdb")
   
    //SQLite数据库
    var FilePath = path&"测试用的部分数据库文件\\test.db"
    var ret=DL.ConnectMyDB("SQLite", "", "", "",FilePath, 0)
        if(ret=1)
        var s1=DL.GetTable("SELECT * FROM people limit 0,10  ")
                messagebox(s1)
        //---------------------------------------------------------------------------------
                   var s2=DL.InsertSQL("insert into people(myname) values(1)")
                   messagebox(s2)
        //---------------------------------------------------------------------------------
                   var s3=DL.UpdateSQL("update people set myname ='givl2' where id = 3")
                   messagebox(s3)
        //---------------------------------------------------------------------------------
                   var s4=DL.DeleteSQL("delete from people where id = 3")
                   messagebox(s4)
        //---------------------------------------------------------------------------------
                   var s5=DL.ExecSQL("insert into people VALUES('1','1','2','3','1','2')")
                   messagebox(s5)
        //---------------------------------------------------------------------------------
        end
        ret = DL.CloseMyDB  
        messagebox(ret)  
   
    //Access数据库
    var FilePath = path&"测试用的部分数据库文件\\my.accdb"
    var ret=DL.ConnectMyDB("Access", "", "", "localhost",FilePath, 0)
        if(ret=1)
        var s1=DL.GetTable("SELECT top 10 * FROM people ")
                messagebox(s1)
        //---------------------------------------------------------------------------------
                   var s2=DL.InsertSQL("insert into 本地学员(myname) values(1)")
                   messagebox(s2)
        //---------------------------------------------------------------------------------
                   var s3=DL.UpdateSQL("update 本地学员 set myname ='givl2' where id = 3")
                   messagebox(s3)
        //---------------------------------------------------------------------------------
                   var s4=DL.DeleteSQL("delete from 本地学员 where id = 1")
                   messagebox(s4)
        //---------------------------------------------------------------------------------
                   var s5=DL.ExecSQL("insert into 本地学员 VALUES('1','1','2','3','1','2')")
                   messagebox(s5)
        //---------------------------------------------------------------------------------
        end
        ret = DL.CloseMyDB  
        messagebox(ret)  
   
    //MySQL数据库
    var ret=DL.ConnectMyDB("MySQL", "root", "1234560", "localhost", "studb", 3306)
        if(ret=1)
        var s1=DL.GetTable("SELECT * FROM people limit 0,10  ")
                messagebox(s1)
        //---------------------------------------------------------------------------------
                   var s2=DL.InsertSQL("insert into people(myname) values(1)")
                   messagebox(s2)
        //---------------------------------------------------------------------------------
                   var s3=DL.UpdateSQL("update people set myname ='givl2' where id = 3")
                   messagebox(s3)
        //---------------------------------------------------------------------------------
                   var s4=DL.DeleteSQL("delete from people where id = 3")
                   messagebox(s4)
        //---------------------------------------------------------------------------------
                   var s5=DL.ExecSQL("insert into people VALUES('1','1','2','3','1','2')")
                   messagebox(s5)
        //---------------------------------------------------------------------------------
        end
        ret = DL.CloseMyDB  
        messagebox(ret)  
   
     //SQL Server数据库
    var ret=DL.ConnectMyDB("SQL Server", "admin", "123456", "202.102.11.252", "datebase", 1433)
        if(ret=1)
        var s1=DL.GetTable("SELECT top 10 * FROM whsw  ")
                messagebox(s1)
        //---------------------------------------------------------------------------------
                   var s2=DL.InsertSQL("insert into whsw(myname) values(1)")
                   messagebox(s2)
        //---------------------------------------------------------------------------------
                   var s3=DL.UpdateSQL("update whsw set myname ='givl2' where id = 3")
                   messagebox(s3)
        //---------------------------------------------------------------------------------
                   var s4=DL.DeleteSQL("delete from whsw where id = 3")
                   messagebox(s4)
        //---------------------------------------------------------------------------------
                   var s5=DL.ExecSQL("insert into whsw VALUES('1','1','2','3','1','2')")
                   messagebox(s5)
        //---------------------------------------------------------------------------------
        end
        ret = DL.CloseMyDB  
        messagebox(ret)  
   
     //Oracle数据库
    var ret=DL.ConnectMyDB("Oracle", "账号", "密码", "localhost", "", 0)
        if(ret=1)
        var s1=DL.GetTable("SELECT top 10 * FROM people  ")
                messagebox(s1)
        //---------------------------------------------------------------------------------
                   var s2=DL.InsertSQL("insert into people(myname) values(1)")
                   messagebox(s2)
        //---------------------------------------------------------------------------------
                   var s3=DL.UpdateSQL("update people set myname ='givl2' where id = 3")
                   messagebox(s3)
        //---------------------------------------------------------------------------------
                   var s4=DL.DeleteSQL("delete from people where id = 3")
                   messagebox(s4)
        //---------------------------------------------------------------------------------
                   var s5=DL.ExecSQL("insert into people VALUES('1','1','2','3','1','2')")
                   messagebox(s5)
        //---------------------------------------------------------------------------------
        end
        ret = DL.CloseMyDB  
        messagebox(ret)     
end
作者: ciiny2017    时间: 2017-10-15 17:31
function button0_click()
        var path=sysgetcurrentpath()       
        var DL=com("DL.DLdb")

    //SQLite数据库
    var FilePath = path&"测试用的部分数据库文件\\test.db"
    var ret=DL.ConnectMyDB("SQLite", "", "", "",FilePath, 0)
        if(ret=1)
        var s1=DL.GetTable("SELECT * FROM people limit 0,10  ")
                messagebox(s1)
        //---------------------------------------------------------------------------------
                   var s2=DL.InsertSQL("insert into people(myname) values(1)")
                   messagebox(s2)
        //---------------------------------------------------------------------------------
                   var s3=DL.UpdateSQL("update people set myname ='givl2' where id = 3")
                   messagebox(s3)
        //---------------------------------------------------------------------------------
                   var s4=DL.DeleteSQL("delete from people where id = 3")
                   messagebox(s4)
        //---------------------------------------------------------------------------------
                   var s5=DL.ExecSQL("insert into people VALUES('1','1','2','3','1','2')")
                   messagebox(s5)
        //---------------------------------------------------------------------------------
        end
        ret = DL.CloseMyDB  
        messagebox(ret)  

    //Access数据库
    var FilePath = path&"测试用的部分数据库文件\\my.accdb"
    var ret=DL.ConnectMyDB("Access", "", "", "localhost",FilePath, 0)
        if(ret=1)
        var s1=DL.GetTable("SELECT top 10 * FROM people ")
                messagebox(s1)
        //---------------------------------------------------------------------------------
                   var s2=DL.InsertSQL("insert into 本地学员(myname) values(1)")
                   messagebox(s2)
        //---------------------------------------------------------------------------------
                   var s3=DL.UpdateSQL("update 本地学员 set myname ='givl2' where id = 3")
                   messagebox(s3)
        //---------------------------------------------------------------------------------
                   var s4=DL.DeleteSQL("delete from 本地学员 where id = 1")
                   messagebox(s4)
        //---------------------------------------------------------------------------------
                   var s5=DL.ExecSQL("insert into 本地学员 VALUES('1','1','2','3','1','2')")
                   messagebox(s5)
        //---------------------------------------------------------------------------------
        end
        ret = DL.CloseMyDB  
        messagebox(ret)  

    //MySQL数据库
    var ret=DL.ConnectMyDB("MySQL", "root", "1234560", "localhost", "studb", 3306)
        if(ret=1)
        var s1=DL.GetTable("SELECT * FROM people limit 0,10  ")
                messagebox(s1)
        //---------------------------------------------------------------------------------
                   var s2=DL.InsertSQL("insert into people(myname) values(1)")
                   messagebox(s2)
        //---------------------------------------------------------------------------------
                   var s3=DL.UpdateSQL("update people set myname ='givl2' where id = 3")
                   messagebox(s3)
        //---------------------------------------------------------------------------------
                   var s4=DL.DeleteSQL("delete from people where id = 3")
                   messagebox(s4)
        //---------------------------------------------------------------------------------
                   var s5=DL.ExecSQL("insert into people VALUES('1','1','2','3','1','2')")
                   messagebox(s5)
        //---------------------------------------------------------------------------------
        end
        ret = DL.CloseMyDB  
        messagebox(ret)  

     //SQL Server数据库
    var ret=DL.ConnectMyDB("SQL Server", "admin", "123456", "202.102.11.252", "datebase", 1433)
        if(ret=1)
        var s1=DL.GetTable("SELECT top 10 * FROM whsw  ")
                messagebox(s1)
        //---------------------------------------------------------------------------------
                   var s2=DL.InsertSQL("insert into whsw(myname) values(1)")
                   messagebox(s2)
        //---------------------------------------------------------------------------------
                   var s3=DL.UpdateSQL("update whsw set myname ='givl2' where id = 3")
                   messagebox(s3)
        //---------------------------------------------------------------------------------
                   var s4=DL.DeleteSQL("delete from whsw where id = 3")
                   messagebox(s4)
        //---------------------------------------------------------------------------------
                   var s5=DL.ExecSQL("insert into whsw VALUES('1','1','2','3','1','2')")
                   messagebox(s5)
        //---------------------------------------------------------------------------------
        end
        ret = DL.CloseMyDB  
        messagebox(ret)  

     //Oracle数据库
    var ret=DL.ConnectMyDB("Oracle", "账号", "密码", "localhost", "", 0)
        if(ret=1)
        var s1=DL.GetTable("SELECT top 10 * FROM people  ")
                messagebox(s1)
        //---------------------------------------------------------------------------------
                   var s2=DL.InsertSQL("insert into people(myname) values(1)")
                   messagebox(s2)
        //---------------------------------------------------------------------------------
                   var s3=DL.UpdateSQL("update people set myname ='givl2' where id = 3")
                   messagebox(s3)
        //---------------------------------------------------------------------------------
                   var s4=DL.DeleteSQL("delete from people where id = 3")
                   messagebox(s4)
        //---------------------------------------------------------------------------------
                   var s5=DL.ExecSQL("insert into people VALUES('1','1','2','3','1','2')")
                   messagebox(s5)
        //---------------------------------------------------------------------------------
        end
        ret = DL.CloseMyDB  
        messagebox(ret)     
end


作者: ciiny2017    时间: 2017-10-15 23:15

function button0_click()
        var path=sysgetcurrentpath()        
        var DL=com("DL.DLdb")
//---------------------------------------------------------------------------------
    //SQLite数据库
    var FilePath = path&"测试用的部分数据库文件\\test.db"
    var ret=DL.ConnectMyDB("SQLite", "", "", "",FilePath, 0)
        if(ret=1)
        var s1=DL.GetTable("SELECT * FROM people limit 0,10  ")
                                   messagebox(s1)

                   var s2=DL.InsertSQL("insert into people(myname) values(1)")
                   messagebox(s2)
        
                   var s3=DL.UpdateSQL("update people set myname ='givl2' where id = 3")
                   messagebox(s3)
        
                   var s4=DL.DeleteSQL("delete from people where id = 3")
                   messagebox(s4)
        
                   var s5=DL.ExecSQL("insert into people VALUES('1','1','2','3','1','2')")
                   messagebox(s5)
        
        end
        ret = DL.CloseMyDB  
        messagebox(ret)  
//---------------------------------------------------------------------------------
    //Access数据库
    var FilePath = path&"测试用的部分数据库文件\\my.accdb"
    var ret=DL.ConnectMyDB("Access", "", "", "localhost",FilePath, 0)
        if(ret=1)
        var s1=DL.GetTable("SELECT top 10 * FROM people ")
                   messagebox(s1)
        
                   var s2=DL.InsertSQL("insert into 本地学员(myname) values(1)")
                   messagebox(s2)
        
                   var s3=DL.UpdateSQL("update 本地学员 set myname ='givl2' where id = 3")
                   messagebox(s3)
        
                   var s4=DL.DeleteSQL("delete from 本地学员 where id = 1")
                   messagebox(s4)
        
                   var s5=DL.ExecSQL("insert into 本地学员 VALUES('1','1','2','3','1','2')")
                   messagebox(s5)
        
        end
        ret = DL.CloseMyDB  
        messagebox(ret)  
//---------------------------------------------------------------------------------
    //MySQL数据库
    var ret=DL.ConnectMyDB("MySQL", "root", "1234560", "localhost", "studb", 3306)
        if(ret=1)
        var s1=DL.GetTable("SELECT * FROM people limit 0,10  ")
                messagebox(s1)
        
                   var s2=DL.InsertSQL("insert into people(myname) values(1)")
                   messagebox(s2)
        
                   var s3=DL.UpdateSQL("update people set myname ='givl2' where id = 3")
                   messagebox(s3)
        
                   var s4=DL.DeleteSQL("delete from people where id = 3")
                   messagebox(s4)
        
                   var s5=DL.ExecSQL("insert into people VALUES('1','1','2','3','1','2')")
                   messagebox(s5)
        
        end
        ret = DL.CloseMyDB  
        messagebox(ret)  
//---------------------------------------------------------------------------------
     //SQL Server数据库
    var ret=DL.ConnectMyDB("SQL Server", "admin", "123456", "202.102.11.252", "datebase", 1433)
        if(ret=1)
        var s1=DL.GetTable("SELECT top 10 * FROM whsw  ")
                messagebox(s1)
        
                   var s2=DL.InsertSQL("insert into whsw(myname) values(1)")
                   messagebox(s2)
        
                   var s3=DL.UpdateSQL("update whsw set myname ='givl2' where id = 3")
                   messagebox(s3)
        
                   var s4=DL.DeleteSQL("delete from whsw where id = 3")
                   messagebox(s4)
        
                   var s5=DL.ExecSQL("insert into whsw VALUES('1','1','2','3','1','2')")
                   messagebox(s5)
        
        end
        ret = DL.CloseMyDB  
        messagebox(ret)  
//---------------------------------------------------------------------------------
     //Oracle数据库
    var ret=DL.ConnectMyDB("Oracle", "账号", "密码", "localhost", "", 0)
        if(ret=1)
        var s1=DL.GetTable("SELECT top 10 * FROM people  ")
                messagebox(s1)
        
                   var s2=DL.InsertSQL("insert into people(myname) values(1)")
                   messagebox(s2)
        
                   var s3=DL.UpdateSQL("update people set myname ='givl2' where id = 3")
                   messagebox(s3)
        
                   var s4=DL.DeleteSQL("delete from people where id = 3")
                   messagebox(s4)
        
                   var s5=DL.ExecSQL("insert into people VALUES('1','1','2','3','1','2')")
                   messagebox(s5)
        
        end
        ret = DL.CloseMyDB  
        messagebox(ret)     
end
作者: donggua11    时间: 2018-1-1 15:28
顶一下,我还差的太远。。。
作者: ciiny2017    时间: 2018-7-24 19:52
QQ群 621816328




欢迎光临 TC官方合作论坛 (http://bbs.52tc.co/) Powered by Discuz! X3.1