Пример #1
0
        private void Createdbtable()
        {
            ADbInteractive db = new ADbInteractive(AStatic.DbPath);

            db.CreateDb(AStatic.DbPath);

            string sql = "create table accounts(id integer primary key, tag text unique not null, category text, url text, user text, password text, phone text, mail text, notes text, lastmodified TimeStamp NOT NULL DEFAULT (datetime('now','localtime')), pyindex text, pyfspell text)";

            db.ExecQuery(sql, null);
        }
Пример #2
0
        private int InsertInto()
        {
            if (!ExistsInDb(tag))
            {
                APinYin pyer = new APinYin();

                string sql = "insert into accounts (tag, category, url, user, password, phone, mail, notes, pyindex, pyfspell) "
                    + "values('"
                + tag + "', '"
                + category + "', '"
                + url + "', '"
                + user + "', '"
                + password + "', '"
                + phone + "', '"
                + mail + "', '"
                + notes + "', '"
                + pyer.GetPyStr(tag, false).ToLower() + "', '"
                + pyer.GetPyStr(tag, true).ToLower() + "')";

                ADbInteractive db = new ADbInteractive(AStatic.DbPath);

                return db.ExecQuery(sql, null);
            }
            else
            {
                return -1;
            }
        }
Пример #3
0
 private int Update()
 {
     string sql = "update accounts set "
     //+ "tag='" + tag + "', "
     + "category='" + category + "',"
     + "url='" + url + "', "
     + "user='******', "
     + "password='******', "
     + "phone='" + phone + "', "
     + "mail='" + mail + "', "
     + "notes='" + notes + "', "
     + "lastmodified=datetime('now','localtime') "
     + "where tag='" + tag + "'";
     ADbInteractive db = new ADbInteractive(AStatic.DbPath);
     return db.ExecQuery(sql, null);
 }
Пример #4
0
 public int DelFromDb(string t)
 {
     string sql = "delete from accounts where tag='" + t + "'";
     ADbInteractive db = new ADbInteractive(AStatic.DbPath);
     return db.ExecQuery(sql, null);
 }