sqlite 資料庫插入1000條後會覆蓋之前資料 無法增加更多

來源:互聯網
上載者:User
關鍵字 php sqlite
用insert into不斷插入資料,但是一個表到1000後發現無法增加資料,新插入的資料好像會覆蓋之前的。
應該如何解決?

我二了,換到同事的資料庫軟體查看,探索資料是有的,只是顯示1000條。

回複內容:

用insert into不斷插入資料,但是一個表到1000後發現無法增加資料,新插入的資料好像會覆蓋之前的。
應該如何解決?

我二了,換到同事的資料庫軟體查看,探索資料是有的,只是顯示1000條。

回答問題

雖然不懂php, 但最近也研究sqlite3, 未發現題主問題.

因為不知道如何用sql來迴圈插入1000條資料, 這裡使用ruby代碼來實現

require 'sqlite3'db = SQLite3::Database.new 'test.db'db.execute "create table tbname (id int);"(1..1005).each {|i| db.execute "insert into tbname values (#{i});" }db.execute "select * from tbname limit 5"  #=> 1 2 3 4 5db.execute "select * from tbname limit 5 offset 1000"  #=> 1001 1002 1003 1004 1005

說明:

  • db.execute後的字串, 即為可執行檔sql語句 ,除了#{i}, 那是Ruby的變數替換

  • 你可以試著在sqlite3的控制台, 執行上述limit的語句來查看是否發生覆蓋.

  • 相關文章

    聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.