UE4、MySQL预处理插入语句
2021/7/26 2:11:59
本文主要是介绍UE4、MySQL预处理插入语句,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
MYSQL_STMT *Ptr = mysql_stmt_init(&mysql); char *SQL = "INSERT INTO ppp1 VALUES(?,?)";//放置注入攻击 int ret = mysql_stmt_prepare(Ptr, SQL, FString(ANSI_TO_TCHAR(SQL)).Len()); if (ret != 0) { GEngine->AddOnScreenDebugMessage(-1, 10, FColor::Red, mysql_stmt_error(Ptr)); return; } int32 id = 100; MYSQL_BIND Pram[2]; FMemory::Memset(Pram, 0, sizeof(Pram)); Pram[0].buffer_type = MYSQL_TYPE_LONG; Pram[0].buffer = &id; Pram[0].length = 0; char *content = "Hello"; uint32 contentlen = strlen(content); Pram[1].buffer_type = MYSQL_TYPE_VARCHAR; //Pram[1].is_null = 0; Pram[1].buffer = content; Pram[1].length = (unsigned long*)&contentlen; Pram[1].buffer_length = contentlen; ret = mysql_stmt_bind_param(Ptr, Pram); if (ret != 0) { GEngine->AddOnScreenDebugMessage(-1, 10, FColor::Red, mysql_stmt_error(Ptr)); return; } ret = mysql_stmt_execute(Ptr); if (ret != 0) { GEngine->AddOnScreenDebugMessage(-1, 10, FColor::Red, mysql_stmt_error(Ptr)); return; } mysql_stmt_close(Ptr);
UE4点击Play后,数据库更新
这篇关于UE4、MySQL预处理插入语句的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-04部署MySQL集群项目实战:新手入门教程
- 2024-11-04如何部署MySQL集群资料:新手入门指南
- 2024-11-02MySQL集群项目实战:新手入门指南
- 2024-11-02初学者指南:部署MySQL集群资料
- 2024-11-01部署MySQL集群教程:新手入门指南
- 2024-11-01如何部署MySQL集群:新手入门教程
- 2024-11-01部署MySQL集群学习:新手入门教程
- 2024-11-01部署MySQL集群入门:新手必读指南
- 2024-10-23BinLog入门:新手必读的MySQL二进制日志指南
- 2024-10-23Binlog入门:MySQL数据库的日志管理指南