zoukankan      html  css  js  c++  java
  • iOS-数据库sqlite的使用

    .数据库的增删查改的方法

    sqlite3_exec(db, [sql UTF8String], NULL, NULL, &erro);

    数据库的使用

           步骤:01.导入框架<sqlite3.h>

            02.创建数据库(sqlite3_exec)并打开数据库(sqlite3_open())

            03.创建表,加入字段(sqlite3_exec)

                    04.实现数据库的增,删,改,查询操作(sqlite3_exec)

    05.关闭数据库(sqlite3_close())

            查询操作步骤:

                      01.校验语句是否合法:sqlite3_prepare_v2

                      02.绑定要查询的数据:sqlite3_bind_text

                      03.循环查找内容(依据行):sqlite3_step

                       04.取出这一行里面的数据(依据相应的类):sqlite3_column_text

    .SQL语句使用的公式

        建表:

            01. creat table 表名(字段名 字段类型,字段名 字段类型)

            02. creat table if not exist 表名(字段名 字段类型,字段名 字段类型)

            列如:creat table if not exist userid integername textphone text);

        插入:insert into 表名(字段,字段)values 内容内容);

        删除:delete from 表名 where 字段 = ‘要删的内容

        改动:update 表名 set 字段 = '改动的内容' where 字段 = '改动前的内容'

        set后面是新的数据,where后面是之前的数据

        查询:

            01.select *from 表名 查询全部的字段(*表示全部)。

            02.select 字段1。字段2....from 表名;

            如:select *from user

     

     

        条件语句:

        where 字段 = 内容;

        where 字段 is 内容;//相当=

        where 字段 = 内容。

        where 字段 is not 内容;

        where 字段 > 内容;

        where 字段 > 内容 and 字段>内容;&& where 字段 > 内容 or 字段 > 内容



  • 相关阅读:
    git中Please enter a commit message to explain why this merge is necessary.
    用$(this)选择其下带有class的子元素
    将某页面中ajax中获取到的信息放置到sessionStorage中保存,并在其他页面调用这些数据。
    返回顶部黑科技
    对于div里面内容过大根据长度或者宽度进行适配,然后可以滚轮缩放的功能
    vue runtime报错问题
    webpack简单配置
    input type=color 设置颜色
    vue统一注册组件
    vue模板字符串写法
  • 原文地址:https://www.cnblogs.com/mfmdaoyou/p/7351206.html
Copyright © 2011-2022 走看看