zoukankan      html  css  js  c++  java
  • SQLite 粗劣内容

    SQLite 的官网

    http://addons.mozillan.org/firefox/addon/sqlite-manager/

    http://www.sqlite.org

     

    sqlite3 *sqlite = nil;

        

        NSString *filePath = [NSHomeDirectory() stringByAppendingPathComponent:@"Documents/data.file" ];

        

        //打开数据库

        int result  = sqlite3_open([filePath  UTF8String], &sqlite);

        if (result !=SQLITE_OK) {

            NSLog(@"创建失败!!!");

            return ;

        }

        

        //创建表的SQL语句

        

        NSString *sql = @"CREATE TABLE IF NOT EXISTS UserTable(userName text PRIMARY KEY ,password text,email text)";

        //执行SQL语句

        char *error;

        result = sqlite3_exec(sqlite, [sql  UTF8String], NULL, NULL, &error);

        if (result != SQLITE_OK) {

            NSLog(@"创建数据库失败:%s",error);

            return ;

        }

        //插如入一条数据

        //INSERT OR REPLACE INTO UserTable (userName,password,email) VALUES(?,?,?);

        //更新一条数据

        //UPDATE UserTable set password = '' where userName = '';

        

        //查询数据

        

        //SELECT userName ,password,eamil FROM UserTable where username = '';

       

        //删除数据

       // DELETE FROM UserTable WHERE username ='';

        

        //关闭数据库

        

        sqlite3_close(sqlite);

  • 相关阅读:
    XAMPP配置8080端口
    Composer安装使用
    .Net商品管理(注释,百度,提问,对比,总结)
    .Net数据库操作
    VS链接数据库
    .Net中字典的使用
    一套解决方案,多个项目
    转化一下解决问题的思路,弯道超车
    灵活的运用Model类
    Razor数组数据
  • 原文地址:https://www.cnblogs.com/meixian/p/5371114.html
Copyright © 2011-2022 走看看