SQLite3ã§æ°ãã«autoincrementã追å ã«ãªã£ããä»ã¾ã§ã®æ大å¤ï¼ï¼ã§ã¯ãªããã¦ãã¼ã¯ãªæ°åã使ãããä»ã®DBã¨åãæ©è½ãsequenceã ã£ããserialã ã£ããauto_incrementã ã£ããã ã§ãå¿ ã1ããã¹ã¿ã¼ããã¦æ¬²ããäºããªãããããªä½¿ãæ¹ããããã¨ãããããããå¾ãããããªã¨ãã¯ãsqlite_sequence(name, seq)ã£ã¦ãã¼ãã«ãããã®ã§ããã®nameã«è©²å½ãããã¼ãã«åãseqã«åæå¤ãããã¦ç½®ãã°æ¬¡åã¤ã³ã¯ãªã¡ã³ããããã¨ãã«ãã®å¤ã使ãããããã«ãªãã ä¾ãã°ããã¼ãã«ï¼tt(code integer primary key autoincrement, name, text)ãªãã¦ãã¼ãã«ããã£ã¦ãcodeã10000ããã¹ã¿ã¼ãããããæ sqlite> select * from sqlite_sequence; ï¼ï¼ç®çã®ã
{{#tags}}- {{label}}
{{/tags}}