自定义sql语句, 自动生成 c++ sqlite3 脚本

该博客介绍了如何通过特定的SQL格式,自动生成C++中的SQLite3接口代码。内容包括规则说明,如命名空间定义、表创建,以及宏定义的接口模板。还提供了源码地址、依赖项、以及使用步骤,帮助开发者实现自动化代码生成。
摘要由CSDN通过智能技术生成

通过规定的sql格式, 生成c++的sqlite3接口

格式规则:

#namespace user_info

#create tables
/*
create table if not exists user_info(
	id integer primary key autoincrement,
	username varchar(32),
	userage int
);
create table if not exists user_info(
	id integer primary key autoincrement,
	username varchar(32),
	userage int
);
*/
#end

#create tables
/*
create table if not exists user_info(
	id integer primary key autoincrement,
	username varchar(32),
	userage int
);
*/
#end

/*
	@bref 插入一条记录
	@in_isarr false
	@out_isarr false
	@in username: string
	@in userage: int
*/
#define add_userinfo
insert into user_info values(null, ?, ?);
#end

/*
	@bref 通过用户ID获取用户信息
	@in_isarr false
	@out_isarr false
	@in id: int
	@out id: int
	@out username: string
	@out userage: int
*/
#define get_userinfo_by_id
select * from user_info
where id = ?;
#end

/*
	@bref 获取全部的人员信息
	@in_isarr false
	@out_is
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值