usage_update_delete_persistents.txt
来自「LiteSQL is a C++ library that integrates」· 文本 代码 · 共 51 行
TXT
51 行
/* LiteSQL - Documentation * * By Tero Laitinen * * See LICENSE for copyright information. *//* \file documentation.txt Manual *//** \page usage_update_delete_persistents Storing and Deleting PersistentsA simple Person database:\code<?xml version="1.0"?><!DOCTYPE database SYSTEM "litesql.dtd"><database name="PersonDatabase"> <object name="Person"> <field name="name" type="string"/> <field name="age" type="integer"/> </object></database>\endcodeFollowing code demonstrates how to insert Persons to database:\codePersonDatabase db("sqlite3", "database=person.db"); // assumes the database has been createdPerson person(db); // construct Person, does not write anything to databaseperson.name = "Bob"; // assign values to fieldsperson.age = 20;person.update(); // writes a new record to databaseperson.age = 21; // Bob got just olderperson.update(); // updates old recordperson.id = 100; // force internal identifier (id) to 100 person.update(); // updates old record\endcodeNote: if internal identifier (id-field) is changed, relations will not "follow"the object and will not be deleted either. If the object is not replaced withanother object, relations should be manually dropped using delRelations-method.Following code demonstrates how to delete Persons from database:\codePerson person = select<Person>(db).one(); // any Person will doperson.del(); // person.onDelete() gets called before data is deleted\endcode*/
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?