{"id":134495,"date":"2020-07-08T00:30:41","date_gmt":"2020-07-07T16:30:41","guid":{"rendered":"http:\/\/4563.org\/?p=134495"},"modified":"2020-07-08T00:30:41","modified_gmt":"2020-07-07T16:30:41","slug":"%e5%85%b3%e4%ba%8e-sqlite3-%e7%9a%84%e4%b8%80%e4%b8%aa%e9%97%ae%e9%a2%98","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=134495","title":{"rendered":"\u5173\u4e8e sqlite3 \u7684\u4e00\u4e2a\u95ee\u9898"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u5173\u4e8e sqlite3 \u7684\u4e00\u4e2a\u95ee\u9898               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : 18870715400 <\/span>  <span><i><\/i> 11<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<h1>\u5efa\u7acb\u8868\u7684\u65f6\u5019\u662f\u4f7f\u7528\u4e86 django \u7684 model \u6765\u5efa\u7acb\u8868\uff0c\u6570\u636e\u5e93\u9009\u62e9 sqlite3<\/h1>\n<p> <\/p>\n<pre><code>anum = models.CharField(max_length=50, default='')  # \u4f46\u662f\u5728 sql \u8bed\u53e5\u63d2\u5165\u7684\u65f6\u5019\u5374\u62a5\u4e86\u4e00\u4e2a\u9519\uff0c  # sqlite3.IntegrityError: NOT NULL constraint failed: table.anum  # \u4f46\u662f\u5728\u5efa\u8868\u7684\u65f6\u5019\u4e0d\u662f\u8bbe\u7f6e\u4e86\u9ed8\u8ba4\u503c\u4e48\uff0c \u4e3a\u4ec0\u4e48\u8fd8\u662f\u9700\u8981 anum \u8fd9\u4e2a\u5b57\u6bb5\uff0c\u53e6\u5916\uff0c \u4f7f\u7528 mysql \u63d2\u5165\u6570\u636e\u7684\u65f6\u5019\u4e0d\u4f1a\u62a5\u8fd9\u4e2a\u9519\u8bef\uff0c \u96be\u9053\u975e\u8981\u52a0\u4e2a null=True \u4e48\uff0c \u53e6\u5916\u4f7f\u7528 sqlite3 \u65f6\u5019\u52a0\u4e0a null=True \u5982\u679c insert \u7684\u65f6\u5019\u4e0d\u4f20\u503c\u5c31\u4f1a\u9ed8\u8ba4\u4e3a null\uff0cdefault \u7684\u503c\u5c31\u4f1a\u6ca1\u7528\u4e86\uff0c\u90a3\u4e48\u5e94\u8be5\u600e\u4e48\u89e3\u51b3\u5462 <\/code><\/pre>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>1<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"2396077\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : xiaolinjia <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             blank=True \u4e0d\u5c31\u597d\u4e86\u3002null=True \u4e0d\u5efa\u8bae\u7528\u5728 CharField \u91cc                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u5173\u4e8e sqlite3 \u7684\u4e00\u4e2a\u95ee\u9898 &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/134495"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=134495"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/134495\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=134495"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=134495"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=134495"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}