WCDB soci 查询语句

测试代码

#pragma once
#include <string>
#include <vector>// Assume OperationLog is a struct representing a row in the table
struct OperationLog {int id;std::string op_type;std::string op_subtype;std::string details;std::string timestamp;
};class OperationLogRepositoryWCDB {
public:// Query by op_typestd::vector<OperationLog> queryByOpType(const std::string& opType);// Query by op_subtypestd::vector<OperationLog> queryByOpSubType(const std::string& opSubType);
};#include "operation_log_repository_wcdb.h"
#include <WCDB/WCDB.h>std::vector<OperationLog> OperationLogRepositoryWCDB::queryByOpType(const std::string& opType) {std::vector<OperationLog> result;WCDB::Database db("operation_log.db");auto rows = db.getRows("operation_log", WCDB::Column::All(), "op_type = ?", {opType});for (const auto& row : rows) {OperationLog log;log.id = row.getValue<int>(0);log.op_type = row.getValue<std::string>(1);log.op_subtype = row.getValue<std::string>(2);log.details = row.getValue<std::string>(3);log.timestamp = row.getValue<std::string>(4);result.push_back(log);}return result;
}std::vector<OperationLog> OperationLogRepositoryWCDB::queryByOpSubType(const std::string& opSubType) {std::vector<OperationLog> result;WCDB::Database db("operation_log.db");auto rows = db.getRows("operation_log", WCDB::Column::All(), "op_subtype = ?", {opSubType});for (const auto& row : rows) {OperationLog log;log.id = row.getValue<int>(0);log.op_type = row.getValue<std::string>(1);log.op_subtype = row.getValue<std::string>(2);log.details = row.getValue<std::string>(3);log.timestamp = row.getValue<std::string>(4);result.push_back(log);}return result;
}#pragma once
#include <string>
#include <vector>// Assume OperationLog is a struct representing a row in the table
struct OperationLog {int id;std::string op_type;std::string op_subtype;std::string details;std::string timestamp;
};class OperationLogRepositorySOCI {
public:// Query by op_typestd::vector<OperationLog> queryByOpType(const std::string& opType);// Query by op_subtypestd::vector<OperationLog> queryByOpSubType(const std::string& opSubType);
};#include "operation_log_repository_soci.h"
#include <soci/soci.h>
#include <soci/sqlite3/soci-sqlite3.h>std::vector<OperationLog> OperationLogRepositorySOCI::queryByOpType(const std::string& opType) {std::vector<OperationLog> result;soci::session sql(soci::sqlite3, "operation_log.db");soci::rowset<soci::row> rs = (sql.prepare << "SELECT id, op_type, op_subtype, details, timestamp FROM operation_log WHERE op_type = :op_type", soci::use(opType));for (const auto& r : rs) {OperationLog log;log.id = r.get<int>(0);log.op_type = r.get<std::string>(1);log.op_subtype = r.get<std::string>(2);log.details = r.get<std::string>(3);log.timestamp = r.get<std::string>(4);result.push_back(log);}return result;
}std::vector<OperationLog> OperationLogRepositorySOCI::queryByOpSubType(const std::string& opSubType) {std::vector<OperationLog> result;soci::session sql(soci::sqlite3, "operation_log.db");soci::rowset<soci::row> rs = (sql.prepare << "SELECT id, op_type, op_subtype, details, timestamp FROM operation_log WHERE op_subtype = :op_subtype", soci::use(opSubType));for (const auto& r : rs) {OperationLog log;log.id = r.get<int>(0);log.op_type = r.get<std::string>(1);log.op_subtype = r.get<std::string>(2);log.details = r.get<std::string>(3);log.timestamp = r.get<std::string>(4);result.push_back(log);}return result;
}

带gtest代码

#pragma once
#include <string>
#include <vector>struct OperationLog {int id;std::string op_type;std::string op_subtype;std::string op_content;std::string timestamp;
};class OperationLogInterface {
public:virtual ~OperationLogInterface() = default;// 1. Query operation_log using op_type as index, limit 20virtual std::vector<OperationLog> queryByOpType(const std::string& op_type) = 0;// 2. Query operation_log using op_subtype as index, limit 20virtual std::vector<OperationLog> queryByOpSubtype(const std::string& op_subtype) = 0;// 3. Query count of total rows in operation_logvirtual int getTotalCount() = 0;
};#include "operation_log_interface.h"
#include <WCDB.h>class OperationLogWCDB : public OperationLogInterface {
public:OperationLogWCDB(const std::string& dbPath): database(dbPath) {}std::vector<OperationLog> queryByOpType(const std::string& op_type) override {std::vector<OperationLog> result;auto statement = WCDB::StatementSelect().from("operation_log").where(WCDB::Column("op_type") == op_type).limit(20);auto rows = database.selectRows(statement);for (const auto& row : rows) {OperationLog log;log.id = row[0].int32Value();log.op_type = row[1].stringValue();log.op_subtype = row[2].stringValue();log.op_content = row[3].stringValue();log.timestamp = row[4].stringValue();result.push_back(log);}return result;}std::vector<OperationLog> queryByOpSubtype(const std::string& op_subtype) override {std::vector<OperationLog> result;auto statement = WCDB::StatementSelect().from("operation_log").where(WCDB::Column("op_subtype") == op_subtype).limit(20);auto rows = database.selectRows(statement);for (const auto& row : rows) {OperationLog log;log.id = row[0].int32Value();log.op_type = row[1].stringValue();log.op_subtype = row[2].stringValue();log.op_content = row[3].stringValue();log.timestamp = row[4].stringValue();result.push_back(log);}return result;}int getTotalCount() override {auto statement = WCDB::StatementSelect().from("operation_log").column(WCDB::Column::count("*"));auto rows = database.selectRows(statement);if (!rows.empty()) {return rows[0][0].int32Value();}return 0;}private:WCDB::Database database;
};#include "operation_log_interface.h"
#include <soci/soci.h>class OperationLogSOCI : public OperationLogInterface {
public:OperationLogSOCI(const std::string& connStr): sql(soci::sqlite3, connStr) {}std::vector<OperationLog> queryByOpType(const std::string& op_type) override {std::vector<OperationLog> result;soci::rowset<soci::row> rs = (sql.prepare << "SELECT id, op_type, op_subtype, op_content, timestamp FROM operation_log WHERE op_type = ? LIMIT 20", op_type);for (auto& r : rs) {OperationLog log;log.id = r.get<int>(0);log.op_type = r.get<std::string>(1);log.op_subtype = r.get<std::string>(2);log.op_content = r.get<std::string>(3);log.timestamp = r.get<std::string>(4);result.push_back(log);}return result;}std::vector<OperationLog> queryByOpSubtype(const std::string& op_subtype) override {std::vector<OperationLog> result;soci::rowset<soci::row> rs = (sql.prepare << "SELECT id, op_type, op_subtype, op_content, timestamp FROM operation_log WHERE op_subtype = ? LIMIT 20", op_subtype);for (auto& r : rs) {OperationLog log;log.id = r.get<int>(0);log.op_type = r.get<std::string>(1);log.op_subtype = r.get<std::string>(2);log.op_content = r.get<std::string>(3);log.timestamp = r.get<std::string>(4);result.push_back(log);}return result;}int getTotalCount() override {int count = 0;sql << "SELECT count(*) FROM operation_log", soci::into(count);return count;}private:soci::session sql;
};#include <gtest/gtest.h>
#include "operation_log_interface.h"// You would need to include the appropriate subclasses and initialize the DB with test data.class OperationLogTest : public ::testing::Test {
protected:void SetUp() override {// initialize db and insert test data for both WCDB and SOCI// You may want to use a test database for this}// Provide implementations for bothOperationLogInterface* wcdb_impl;OperationLogInterface* soci_impl;
};// Test queryByOpType
TEST_F(OperationLogTest, QueryByOpType_WCDB) {auto logs = wcdb_impl->queryByOpType("typeA");ASSERT_LE(logs.size(), 20);for (const auto& log : logs) {EXPECT_EQ(log.op_type, "typeA");}
}
TEST_F(OperationLogTest, QueryByOpType_SOCI) {auto logs = soci_impl->queryByOpType("typeA");ASSERT_LE(logs.size(), 20);for (const auto& log : logs) {EXPECT_EQ(log.op_type, "typeA");}
}// Test queryByOpSubtype
TEST_F(OperationLogTest, QueryByOpSubtype_WCDB) {auto logs = wcdb_impl->queryByOpSubtype("subtypeB");ASSERT_LE(logs.size(), 20);for (const auto& log : logs) {EXPECT_EQ(log.op_subtype, "subtypeB");}
}
TEST_F(OperationLogTest, QueryByOpSubtype_SOCI) {auto logs = soci_impl->queryByOpSubtype("subtypeB");ASSERT_LE(logs.size(), 20);for (const auto& log : logs) {EXPECT_EQ(log.op_subtype, "subtypeB");}
}// Test getTotalCount
TEST_F(OperationLogTest, GetTotalCount_WCDB) {int count = wcdb_impl->getTotalCount();// Expect count equals to number of inserted rowsEXPECT_GT(count, 0);
}
TEST_F(OperationLogTest, GetTotalCount_SOCI) {int count = soci_impl->getTotalCount();EXPECT_GT(count, 0);
}

另一版测试代码

#include "operation_log_wcdb.h"
#include <WCDB/WCDBCpp.h>using namespace WCDB;OperationLogWCDB::OperationLogWCDB(const std::string& dbPath): m_dbPath(dbPath)
{
}OperationLogWCDB::~OperationLogWCDB() = default;bool OperationLogWCDB::InitDB()
{m_db = std::make_unique<Database>(m_dbPath);if (!m_db->isOpened()) {m_db->open();}// Create table if not existsstd::string sql = "CREATE TABLE IF NOT EXISTS operation_log (""id INTEGER PRIMARY KEY AUTOINCREMENT, ""op_type TEXT, ""op_subtype TEXT, ""detail TEXT, ""ts INTEGER)";return m_db->execute(sql);
}bool OperationLogWCDB::Insert(const OperationLogRow& row)
{StatementInsert insert("operation_log");insert.columns({"op_type", "op_subtype", "detail", "ts"});insert.values({row.op_type, row.op_subtype, row.detail, row.ts});return m_db->execute(insert);
}std::vector<OperationLogRow> OperationLogWCDB::QueryByOpType(const std::string& opType, int limit)
{StatementSelect select("operation_log");select.columns({"id", "op_type", "op_subtype", "detail", "ts"});select.where(Column("op_type") == opType);select.limit(limit);std::vector<OperationLogRow> results;auto rows = m_db->getRows(select);for (const auto& row : rows) {OperationLogRow log;log.id = row[0].int64Value();log.op_type = row[1].stringValue();log.op_subtype = row[2].stringValue();log.detail = row[3].stringValue();log.ts = row[4].int64Value();results.push_back(log);}return results;
}std::vector<OperationLogRow> OperationLogWCDB::QueryByOpSubType(const std::string& opSubType, int limit)
{StatementSelect select("operation_log");select.columns({"id", "op_type", "op_subtype", "detail", "ts"});select.where(Column("op_subtype") == opSubType);select.limit(limit);std::vector<OperationLogRow> results;auto rows = m_db->getRows(select);for (const auto& row : rows) {OperationLogRow log;log.id = row[0].int64Value();log.op_type = row[1].stringValue();log.op_subtype = row[2].stringValue();log.detail = row[3].stringValue();log.ts = row[4].int64Value();results.push_back(log);}return results;
}int64_t OperationLogWCDB::QueryRowCount()
{StatementSelect select("operation_log");select.columns({"COUNT(*)"});auto rows = m_db->getRows(select);if (!rows.empty()) {return rows[0][0].int64Value();}return 0;
}#include "operation_log_soci.h"
#include <soci/sqlite3/soci-sqlite3.h>OperationLogSOCI::OperationLogSOCI(const std::string& connectString)
{m_session = std::make_unique<soci::session>(soci::sqlite3, connectString);
}OperationLogSOCI::~OperationLogSOCI() = default;bool OperationLogSOCI::InitDB()
{try {*m_session << "CREATE TABLE IF NOT EXISTS operation_log (""id INTEGER PRIMARY KEY AUTOINCREMENT, ""op_type TEXT, ""op_subtype TEXT, ""detail TEXT, ""ts INTEGER)";return true;} catch (...) {return false;}
}bool OperationLogSOCI::Insert(const OperationLogRow& row)
{try {*m_session << "INSERT INTO operation_log (op_type, op_subtype, detail, ts) VALUES (:op_type, :op_subtype, :detail, :ts)",soci::use(row.op_type), soci::use(row.op_subtype), soci::use(row.detail), soci::use(row.ts);return true;} catch (...) {return false;}
}std::vector<OperationLogRow> OperationLogSOCI::QueryByOpType(const std::string& opType, int limit)
{std::vector<OperationLogRow> results;soci::rowset<soci::row> rs =(m_session->prepare << "SELECT id, op_type, op_subtype, detail, ts FROM operation_log WHERE op_type = :op_type LIMIT :limit",soci::use(opType), soci::use(limit));for (auto it = rs.begin(); it != rs.end(); ++it) {const soci::row& r = *it;OperationLogRow log;log.id = r.get<int64_t>(0);log.op_type = r.get<std::string>(1);log.op_subtype = r.get<std::string>(2);log.detail = r.get<std::string>(3);log.ts = r.get<int64_t>(4);results.push_back(log);}return results;
}std::vector<OperationLogRow> OperationLogSOCI::QueryByOpSubType(const std::string& opSubType, int limit)
{std::vector<OperationLogRow> results;soci::rowset<soci::row> rs =(m_session->prepare << "SELECT id, op_type, op_subtype, detail, ts FROM operation_log WHERE op_subtype = :op_subtype LIMIT :limit",soci::use(opSubType), soci::use(limit));for (auto it = rs.begin(); it != rs.end(); ++it) {const soci::row& r = *it;OperationLogRow log;log.id = r.get<int64_t>(0);log.op_type = r.get<std::string>(1);log.op_subtype = r.get<std::string>(2);log.detail = r.get<std::string>(3);log.ts = r.get<int64_t>(4);results.push_back(log);}return results;
}int64_t OperationLogSOCI::QueryRowCount()
{int64_t cnt = 0;*m_session << "SELECT COUNT(*) FROM operation_log", soci::into(cnt);return cnt;
}#pragma once#include <string>
#include <vector>
#include <memory>// WCDB Forward declarations
class WCDBDatabase;struct OperationLogRow {int64_t id;std::string op_type;std::string op_subtype;std::string detail;int64_t ts;
};class OperationLogWCDB {
public:OperationLogWCDB(const std::string& dbPath);~OperationLogWCDB();bool InitDB();bool Insert(const OperationLogRow& row);std::vector<OperationLogRow> QueryByOpType(const std::string& opType, int limit = 20);std::vector<OperationLogRow> QueryByOpSubType(const std::string& opSubType, int limit = 20);int64_t QueryRowCount();private:std::unique_ptr<WCDBDatabase> m_db;std::string m_dbPath;
};#pragma once#include <string>
#include <vector>
#include <memory>
#include <soci/soci.h>struct OperationLogRow {int64_t id;std::string op_type;std::string op_subtype;std::string detail;int64_t ts;
};class OperationLogSOCI {
public:OperationLogSOCI(const std::string& connectString);~OperationLogSOCI();bool InitDB();bool Insert(const OperationLogRow& row);std::vector<OperationLogRow> QueryByOpType(const std::string& opType, int limit = 20);std::vector<OperationLogRow> QueryByOpSubType(const std::string& opSubType, int limit = 20);int64_t QueryRowCount();private:std::unique_ptr<soci::session> m_session;
};#include <gtest/gtest.h>
#include "operation_log_wcdb.h"
#include "operation_log_soci.h"
#include <cstdio>// Helper to clean up db file
void RemoveDBFile(const std::string& path) {std::remove(path.c_str());
}OperationLogRow MakeTestRow(int idx, const std::string& type = "typeA", const std::string& subtype = "subtypeA") {OperationLogRow row;row.id = 0;row.op_type = type;row.op_subtype = subtype;row.detail = "detail_" + std::to_string(idx);row.ts = 1000 + idx;return row;
}TEST(OperationLogWCDBTest, BasicCRUD) {std::string dbPath = "test_wcdb.sqlite";RemoveDBFile(dbPath);OperationLogWCDB db(dbPath);ASSERT_TRUE(db.InitDB());// Insert 30 rows, 10 with typeA, 20 with typeBfor (int i = 0; i < 10; ++i)ASSERT_TRUE(db.Insert(MakeTestRow(i, "typeA", "subtypeA")));for (int i = 10; i < 30; ++i)ASSERT_TRUE(db.Insert(MakeTestRow(i, "typeB", "subtypeB")));EXPECT_EQ(db.QueryRowCount(), 30);auto typeAList = db.QueryByOpType("typeA", 20);EXPECT_EQ(typeAList.size(), 10);EXPECT_EQ(typeAList[0].op_type, "typeA");auto subtypeBList = db.QueryByOpSubType("subtypeB", 20);EXPECT_EQ(subtypeBList.size(), 20);EXPECT_EQ(subtypeBList[0].op_subtype, "subtypeB");RemoveDBFile(dbPath);
}TEST(OperationLogSOCI, BasicCRUD) {std::string dbPath = "test_soci.sqlite";RemoveDBFile(dbPath);OperationLogSOCI db(dbPath);ASSERT_TRUE(db.InitDB());// Insert 30 rows, 15 with typeA, 15 with typeBfor (int i = 0; i < 15; ++i)ASSERT_TRUE(db.Insert(MakeTestRow(i, "typeA", "subtypeA")));for (int i = 15; i < 30; ++i)ASSERT_TRUE(db.Insert(MakeTestRow(i, "typeB", "subtypeB")));EXPECT_EQ(db.QueryRowCount(), 30);auto typeAList = db.QueryByOpType("typeA", 20);EXPECT_EQ(typeAList.size(), 15);EXPECT_EQ(typeAList[0].op_type, "typeA");auto subtypeBList = db.QueryByOpSubType("subtypeB", 20);EXPECT_EQ(subtypeBList.size(), 15);EXPECT_EQ(subtypeBList[0].op_subtype, "subtypeB");RemoveDBFile(dbPath);
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.pswp.cn/web/89333.shtml
繁体地址,请注明出处:http://hk.pswp.cn/web/89333.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

lesson16:Python函数的认识

目录 一、为什么需要函数&#xff1f; 1. 拒绝重复造轮子 2. 让代码像句子一样可读 3. 隔离变化&#xff0c;降低维护成本 二、函数的定义&#xff1a;编写高质量函数的5个要素 基本语法框架 1. 函数命名的黄金法则&#xff08;PEP8规范&#xff09; 2. 不可或缺的文档…

通过轮询方式使用LoRa DTU有什么缺点?

在物联网系统中&#xff0c;DTU&#xff08;Data Transfer Unit&#xff09;通常用于通过485或M-Bus等接口抄读子设备的数据&#xff0c;并将这些数据传输到平台侧。然而&#xff0c;如果DTU采用轮询方式与平台通信&#xff0c;会带来一系列问题&#xff0c;尤其是在功耗和系统…

Syntax Error: Error: PostCSS received undefined instead of CSS string

报错&#xff1a;Syntax Error: Error: PostCSS received undefined instead of CSS string npm rebuild node-sass报错&#xff1a;npm i canvas 报错 canvas2.11.2 run install node-pre-gyp install --fallback-to-build --update-binary npm install canvas --canvas_binar…

人工智能之数学基础:概率论和数理统计在机器学习的地位

概率和统计的概念概率统计是各类学科中唯一一门专门研究随机现象的规律性的学科&#xff0c;随机现象的广泛性决定了这一学科的重要性。概率论是数学的分支&#xff0c;它研究的是如何定量描述随机现象及其规律。我们之前经常在天气软件上看到&#xff1a;“今天下雨的概率是95…

第十四章 Stream API

JAVA语言引入了一个流式Stream API,这个API对集合数据进行操作&#xff0c;类似于使用SQL执行的数据库查询&#xff0c;同样可以使用Stream API并行执行操作。Stream和Collection的区别Collection:静态的内存数据结构&#xff0c;强调的是数据。Stream API:和集合相关的计算操作…

Oracle数据库各版本间的技术迭代详解

今天我想和大家聊聊一个我们可能每天都在用&#xff0c;但未必真正了解的技术——Oracle数据库的版本。如果你是企业的IT工程师&#xff0c;可能经历过“升级数据库”的头疼&#xff1b;如果你是业务负责人&#xff0c;可能疑惑过“为什么一定要换新版本”&#xff1b;甚至如果…

论文reading学习记录3 - weekly - 模块化视觉端到端ST-P3

文章目录前言一、摘要与引言二、Related Word2.1 可解释的端到端架构2.2 鸟瞰图2.3 未来预测2.4 规划三、方法3.1 感知bev特征积累3.1.1 空间融合&#xff08;帧的对齐&#xff09;3.1.2 时间融合3.2 预测&#xff1a;双路径未来建模3.3 规划&#xff1a;先验知识的整合与提炼4…

crawl4ai--bitcointalk爬虫实战项目

&#x1f4cc; 项目目标本项目旨在自动化抓取 Bitcointalk 论坛中指定板块的帖子数据&#xff08;包括主贴和所有回复&#xff09;&#xff0c;并提取出结构化信息如标题、作者、发帖时间、用户等级、活跃度、Merit 等&#xff0c;以便进一步分析或使用。本项目只供科研学习使用…

调用 System.gc() 的弊端及修复方式

弊端分析不可控的执行时机System.gc() 仅是 建议 JVM 执行垃圾回收&#xff0c;但 JVM 可自由忽略该请求&#xff08;尤其是高负载时&#xff09;。实际回收时机不确定&#xff0c;无法保证内存及时释放。严重的性能问题Stop-The-World 停顿&#xff1a;触发 Full GC 时会暂停所…

git merge 和 git rebase 的区别

主要靠一张图&#xff1a;区别 git merge git checkout feature git merge master此时在feature上git会自动产生一个新的commit 修改的是当前分支 feature。 git rebase git checkout feature git rebase master&#xff08;在feature分支上执行&#xff0c;修改的是master分支…

Java学习--JVM(2)

JVM提供垃圾回收机制&#xff0c;其也是JVM的核心机制&#xff0c;其主要是实现自动回收不再被引用的对象所占用的内存&#xff1b;对内存进行整理&#xff0c;防止内存碎片化&#xff1b;以及对内存分配配进行管理。JVM 通过两种主要算法判断对象是否可回收&#xff1a;引用计…

用大模型(qwen)提取知识三元组并构建可视化知识图谱:从文本到图谱的完整实现

引言 知识图谱作为一种结构化的知识表示方式&#xff0c;在智能问答、推荐系统、数据分析等领域有着广泛应用。在信息爆炸的时代&#xff0c;如何从非结构化文本中提取有价值的知识并进行结构化展示&#xff0c;是NLP领域的重要任务。知识三元组&#xff08;Subject-Relation-O…

(附源码)基于 Go 和 gopacket+Fyne 的跨平台网络抓包工具开发实录

基于 Go 和 gopacket Fyne 的跨平台网络抓包工具开发实录 一、项目背景 在网络安全、协议分析、运维排查等场景中&#xff0c;抓包工具是不可或缺的利器。Wireshark 虽然功能强大&#xff0c;但对于部分初学者或有定制需求的开发者来说&#xff0c;学习曲线较陡&#xff0c;且…

Langchain和Faiss搭建本地知识库对比

对比 对比维度及优缺点分析对比维度LangChain&#xff08;封装 FAISS&#xff09;直接使用 FAISS易用性✅ 高&#xff0c;提供高级封装&#xff0c;简化开发流程❌ 中等&#xff0c;需要熟悉 FAISS API学习成本✅ 低&#xff0c;适合快速开发❌ 高&#xff0c;需要掌握 FAISS 的…

Java常用命令汇总

JDK 工具命令jps&#xff08;Java Virtual Machine Process Status Tool&#xff09;命令示例&#xff1a;jps -l 应用场景&#xff1a;列出当前系统中所有Java进程的PID和主类名&#xff0c;常用于快速定位Java应用的进程ID。javac&#xff08;Java Compiler&#xff09;命令示…

Llama 2:开放基础模型与微调聊天模型

温馨提示&#xff1a; 本篇文章已同步至"AI专题精讲" Llama 2&#xff1a;开放基础模型与微调聊天模型 摘要 在本研究中&#xff0c;我们开发并发布了 Llama 2&#xff0c;一组预训练和微调的大型语言模型&#xff08;LLMs&#xff09;&#xff0c;其规模从 70 亿参…

ThinkPHP 8 在 Apache 下启用伪静态

ThinkPHP 8 在 Apache 下启用伪静态&#xff0c;需要配置 .htaccess 文件并确保 Apache 支持 URL 重写。以下是详细设置步骤&#xff1a;1. 启用 Apache 重写模块首先确保 Apache 的 mod_rewrite 模块已启用。编辑 Apache 配置文件&#xff08;通常是 /etc/apache2/apache2.con…

Android开发中Retrofit使用方法与底层原理详解

Retrofit 是 Android 开发中一个 类型安全、基于注解、高度解耦 的 RESTful HTTP 客户端库&#xff0c;由 Square 公司开发。它极大地简化了 Android 应用与 Web 服务进行网络交互的过程。 核心价值&#xff1a; 声明式 API 定义&#xff1a; 使用 Java/Kotlin 接口和注解描述 …

基于FPGA的IIC控制EEPROM读写(2)

基于FPGA的IIC控制EEPROM读写 文章目录基于FPGA的IIC控制EEPROM读写一、EEPROM简介二、代码实现——个人理解1、状态机2、仿真效果3、上板验证4、代码top.viic_master.vuart三、代码实现——复用性较高的IIC模块1、框架设计2、状态机设计3、仿真效果4、上板验证5、代码top.viic…

C# 界面程序在23H2型号系统中无法退出

20250716记录 环境&#xff1a;c# winform问题描述&#xff1a;主界面退出直接使用了Environment.Exit(0); 程序假死&#xff0c;无法关闭解决措施&#xff1a;//使用 this.Close();以下代码目标&#xff1a;执行完程序自身后&#xff0c;删除指定文件&#xff08;可用于程序文…