iPhone,sqlite3,如何尽可能确定几行代码中已经存在表? [英] iPhone, sqlite3, how can I determine is a table exists already in a few lines of code as possible?

查看:33
本文介绍了iPhone,sqlite3,如何尽可能确定几行代码中已经存在表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在尽可能少的代码行中再次开始向表添加数据之前确定表中已经存在?

How can I determine in a table already exists before I start adding data to it again, in as few lines of code as possible?

推荐答案

如果直接使用sqlite,可以使用如下查询查看表是否已经存在:

If you are using sqlite directly, you can use the following query to see if the table already exists:

SELECT name FROM sqlite_master WHERE type='table' AND name='my_table_name';

这篇关于iPhone,sqlite3,如何尽可能确定几行代码中已经存在表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆