Features

  •  Execute SQL statements within blueprints
  •  Queries are ran asynchronously in UE4’s async thread pool
  •  Depending on query result size, hundreds of queries can execute at once without any noticeable lag on the game thread

Code Modules

  •  Core
  •  CoreUObject
  •  Engine

How to create and execute a query in blueprints (See Blueprint Screenshot)

  1. Construct a Query UObject
  2. Promote the constructed Query UObject to a variable
  3. Bind the OnQueryFinished event
  4. Add a DatabaseRowModel struct variable. The DatabaseRowModel should contain the array of DatabaseColumnModels which contains the column name and variable type definitions. The StringBufferSize is only needed for string columns
  5. Call ExecuteQueryAsync on the DatabaseQuery object
  6. A DatabaseQueryResult should be returned populated with results
  7. You can GetValueAsString on a result column or cast it to it’s variable type column to avoid converting it to a string

Behind the scenes:

  1. ExecuteQueryAsync is called
  2. DatabaseQueryResult UObject is created on the game thread
  3. FNonAbandonableTask is created and begins to run async
  4. Inside of the async thread a connection is created to the SQL database
  5. QueryResultRowStructs are created for each result row and populated by ODBC SQLFetch()
  6. The FNonAbandonableTask returns the populated QueryResultStruct to the game thread and destroys
  7. The game thread converts the QueryResultStruct to the UDatabaseQueryResult created in step 2
  8. The blueprint friendly OnQueryFinished is broadcast with the populated UDatabaseQueryResult

特征

  •  在蓝图中执行SQL语句
  •  在UE4的异步线程池中异步运行查询
  •  根据查询结果的大小,可以同时执行数百个查询,而不会在游戏线程上出现任何明显的滞后

代码模块

  •  核心
  •  [医]核心对象
  •  发动机

如何在蓝图中创建和执行查询 (请参阅蓝图截图)

  1. 构造查询UObject
  2. 将构造的查询UObject提升为变量
  3. 绑定OnQueryFinished事件
  4. 添加DatabaseRowModel结构变量。 DatabaseRowModel应包含Databasecolumnmodel数组,其中包含列名和变量类型定义。 字符串列只需要StringBufferSize
  5. 在DatabaseQuery对象上调用ExecuteQueryAsync
  6. 应返回带有结果的DatabaseQueryResult
  7. 您可以在结果列上GetValueAsString或将其强制转换为变量类型列,以避免将其转换为字符串

幕后:

  1. ExecuteQueryAsync被调用
  2. DatabaseQueryResult UObject在游戏线程上创建
  3. FNonAbandonableTask创建完毕,开始异步运行
  4. 在异步线程内部,将创建到SQL数据库的连接
  5. 为每个结果行创建QueryResultRowStructs,并由ODBC SQLFetch()填充
  6. FNonAbandonableTask将填充的QueryResultStruct返回到游戏线程并销毁
  7. 游戏线程将QueryResultStruct转换为步骤2中创建的UDatabaseQueryResult
  8. 蓝图友好的OnQueryFinished与填充的UDatabaseQueryResult一起广播

Works on Linux now! | REQUIRES FREE ODBC DRIVERS | Works on all common databases like SQL, MySql, Oracle etc… (You just have to chose the right ODBC driver)

This plugin can execute database queries within blueprints using ODBC. ODBC is a free, old school, stable, reliable, and cross-platform way to talk to a database. Most common database frameworks can use ODBC. SQL, MySql, Oracle, Azure, Amazon etc… can all be queried with this plugin. Blueprint usage is VERY similar to the widely used VaRest plugin. It utilizes UE4’s FNonAbandonableTask to execute queries asynchronously without blocking the game thread.

NEVER put a database connection string in something you’ll give to a stranger. I put mine in a config file only found on my Linux game servers. This plugin is for dedicated server side logic, or local database logic only.

Tutorial Video

Active Support: https://discord.gg/Sd4B2rm

About Me

I was the lead network engineer for a game studio using UE4. I’ve been a full-stack developer for 10 years. I specialize in making computers talk with SQL and .Net Core. I’ve built websites, email/fax/voice servers, matchmaking servers, torrent systems, and other network heavy logic. This plugin will improve overtime as I need it for my project https://www.thumpergames.com/world-of-pursuits.

现在在Linux上工作! /需要免费的ODBC驱动程序/适用于所有常见的数据库,如SQL、MySql、Oracle等。.. (你只需要选择正确的ODBC驱动程序)

此插件可以使用ODBC在蓝图中执行数据库查询。 ODBC是一种免费的、老派的、稳定的、可靠的、跨平台的与数据库交谈的方式. 大多数常见的数据库框架都可以使用ODBC。 SQL,MySql,Oracle,Azure,Amazon等。.. 都可以用这个插件查询。 蓝图的用法与广泛使用的VaRest插件非常相似。 它利用UE4的FNonAbandonableTask异步执行查询,而不会阻塞游戏线程。

永远不要把数据库连接字符串放在你会给陌生人的东西中。 我把我的放在一个配置文件中,只在我的Linux游戏服务器上找到。 此插件仅适用于专用服务器端逻辑或本地数据库逻辑。

教程视频

积极支持: https://discord.gg/Sd4B2rm

关于我

我是一个使用UE4的游戏工作室的首席网络工程师。 我已经做了10年的全栈开发人员了. 我专注于使计算机与SQL和.Net Core交谈。 我已经建立了网站,电子邮件/传真/语音服务器,配对服务器,洪流系统和其他网络重逻辑。 这个插件将改善加班,因为我需要它为我的项目 https://www.thumpergames.com/world-of-pursuits.

声明:本站所有资源都是由站长从网络上收集而来,如若本站内容侵犯了原著者的合法权益,可联系站长删除。