search
HomeDatabaseMysql Tutorial『练手』003 Laura.SqlForever如何扩展 兼容更多数据库引擎

003 Laura.SqlForever 如何扩展 兼容更多数据库引擎 数据库引擎插件 在 界面上的体现 导航窗体 的 工具栏 中的 引擎下拉列表 导航窗体 的 树形控件 中的 引擎主节点 登录窗体 的 登陆面板 综上 扩展一个 数据库引擎 最终 会有三个 地方的 UI 体现 而 工具栏

 003 Laura.SqlForever如何扩展 兼容更多数据库引擎

 

数据库引擎插件 在 界面上的体现

       导航窗体 的 工具栏 中的 引擎下拉列表

『练手』003 Laura.SqlForever如何扩展 兼容更多数据库引擎

       导航窗体 的 树形控件 中的 引擎主节点

『练手』003 Laura.SqlForever如何扩展 兼容更多数据库引擎

       登录窗体 的 登陆面板

『练手』003 Laura.SqlForever如何扩展 兼容更多数据库引擎

 

综上

扩展一个 数据库引擎 最终 会有三个 地方的 UI体现

而 工具栏,菜单栏,右键菜单,子节点 则有 另外的扩展 方式

 

具体代码





『练手』003 Laura.SqlForever如何扩展 兼容更多数据库引擎

 

代码详解

以上图代码为例:

特性 中: Caption 将在 界面展示 时 显示的文本

       Key     程序内部 处理时 的键值(不区分大小写)

       DbEngineType       当前引擎的类型(和 当前类名 保持一致)

       Image     数据库引擎 图标(不指定 其实也没有关系)



『练手』003 Laura.SqlForever如何扩展 兼容更多数据库引擎

 

数据类型转换接口

       >这里就不列出 接口需要实现 的函数,只顺带说说 这个接口存在的思想:

>Laura.SqlForever 能够实现 跨数据库 的 结构迁移 数据迁移;

>但是 不同的数据库引擎 数据类型 各不相同;

>于是 Laura.SqlForever 实现了 统一类型:所有 数据库类型 和 统一类型 的 互转 是跨数据库类型的核心思想;

 

操作数据库结构接口

       >包括 读取 数据库 库结构,表结构  &  创建 数据库 库结构,表结构;

 

登陆面板获取函数 GetLoginPanel()

       >该函数 将 返回一个 UI控件,这个 控件最终 被显示 到 登录窗体中;

 

创建主数据库节点函数 CreateDataEngineNode()

       >该函数 将 返回一个 TreeNode控件,这个 主节点具体的子节点 Laura.SqlForever 不予干涉;

 

数据库引擎 树形节点 扩展

Laura.SqlForever 对 树形控件 主引擎的节点 其实不予干涉 —— 开发者 有 自己的自由;

但是 Laura.SqlForever 对 树形控件 的 节点扩展 也提供了 额外封装:

       >以简化 扩展代码 的复杂度

       >封装 多线程,在节点 展开时 才 异步获取数据,改善用于体验

       >具体 是 DbTreeNode  DbFolderTreeNode 两个 基类

具体代码




『练手』003 Laura.SqlForever如何扩展 兼容更多数据库引擎

代码 就 不予详解

>上面 IDataTableFolderNode 只是一个 标记接口(没有任何 函数),加上 这个接口 的节点 将具备 Laura.SqlForever 内置 的 右键菜单项 新建表(N) …”

>不继承 IDataTableFolderNode 也不会影响 程序运行,只不过 这个节点 将失去一个 右键菜单项 而已 —— 而你,可以选择 不使用 内置的右键菜单,自己扩展 右键菜单项;

       >    『练手』003 Laura.SqlForever如何扩展 兼容更多数据库引擎

这里的 “新建表(N)…”是 内置右键菜单项 (只针对 IDataTableFolderNode 节点)

这里的 “刷新(F)”是 内置的右键菜单项(针对 任何 节点)

 

 

 

Ps.   具体更多 详细信息,可以参见 Laura.SqlForever 的详细源码

Laura.SqlForever 完全开源,任何 企业或个人 都可以 剪切,复制,删除,更改 Laura.SqlForever 的任何代码片段。

 

 

 

                                                             舒小龙

                                                        2014-02-12 16:38

 

 

 

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
What Are the Limitations of Using Views in MySQL?What Are the Limitations of Using Views in MySQL?May 14, 2025 am 12:10 AM

MySQLviewshavelimitations:1)Theydon'tsupportallSQLoperations,restrictingdatamanipulationthroughviewswithjoinsorsubqueries.2)Theycanimpactperformance,especiallywithcomplexqueriesorlargedatasets.3)Viewsdon'tstoredata,potentiallyleadingtooutdatedinforma

Securing Your MySQL Database: Adding Users and Granting PrivilegesSecuring Your MySQL Database: Adding Users and Granting PrivilegesMay 14, 2025 am 12:09 AM

ProperusermanagementinMySQLiscrucialforenhancingsecurityandensuringefficientdatabaseoperation.1)UseCREATEUSERtoaddusers,specifyingconnectionsourcewith@'localhost'or@'%'.2)GrantspecificprivilegeswithGRANT,usingleastprivilegeprincipletominimizerisks.3)

What Factors Influence the Number of Triggers I Can Use in MySQL?What Factors Influence the Number of Triggers I Can Use in MySQL?May 14, 2025 am 12:08 AM

MySQLdoesn'timposeahardlimitontriggers,butpracticalfactorsdeterminetheireffectiveuse:1)Serverconfigurationimpactstriggermanagement;2)Complextriggersincreasesystemload;3)Largertablesslowtriggerperformance;4)Highconcurrencycancausetriggercontention;5)M

MySQL: Is it safe to store BLOB?MySQL: Is it safe to store BLOB?May 14, 2025 am 12:07 AM

Yes,it'ssafetostoreBLOBdatainMySQL,butconsiderthesefactors:1)StorageSpace:BLOBscanconsumesignificantspace,potentiallyincreasingcostsandslowingperformance.2)Performance:LargerrowsizesduetoBLOBsmayslowdownqueries.3)BackupandRecovery:Theseprocessescanbe

MySQL: Adding a user through a PHP web interfaceMySQL: Adding a user through a PHP web interfaceMay 14, 2025 am 12:04 AM

Adding MySQL users through the PHP web interface can use MySQLi extensions. The steps are as follows: 1. Connect to the MySQL database and use the MySQLi extension. 2. Create a user, use the CREATEUSER statement, and use the PASSWORD() function to encrypt the password. 3. Prevent SQL injection and use the mysqli_real_escape_string() function to process user input. 4. Assign permissions to new users and use the GRANT statement.

MySQL: BLOB and other no-sql storage, what are the differences?MySQL: BLOB and other no-sql storage, what are the differences?May 13, 2025 am 12:14 AM

MySQL'sBLOBissuitableforstoringbinarydatawithinarelationaldatabase,whileNoSQLoptionslikeMongoDB,Redis,andCassandraofferflexible,scalablesolutionsforunstructureddata.BLOBissimplerbutcanslowdownperformancewithlargedata;NoSQLprovidesbetterscalabilityand

MySQL Add User: Syntax, Options, and Security Best PracticesMySQL Add User: Syntax, Options, and Security Best PracticesMay 13, 2025 am 12:12 AM

ToaddauserinMySQL,use:CREATEUSER'username'@'host'IDENTIFIEDBY'password';Here'showtodoitsecurely:1)Choosethehostcarefullytocontrolaccess.2)SetresourcelimitswithoptionslikeMAX_QUERIES_PER_HOUR.3)Usestrong,uniquepasswords.4)EnforceSSL/TLSconnectionswith

MySQL: How to avoid String Data Types common mistakes?MySQL: How to avoid String Data Types common mistakes?May 13, 2025 am 12:09 AM

ToavoidcommonmistakeswithstringdatatypesinMySQL,understandstringtypenuances,choosetherighttype,andmanageencodingandcollationsettingseffectively.1)UseCHARforfixed-lengthstrings,VARCHARforvariable-length,andTEXT/BLOBforlargerdata.2)Setcorrectcharacters

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool