<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                ## 問題 你想在Node.js中訪問[SQLite](http://www.sqlite.org/)數據庫。 ## 方法 使用[SQLite module](http://code.google.com/p/node-sqlite/)。 ~~~ sqlite = require 'sqlite' db = new sqlite.Database # The module uses asynchronous methods, # so we chain the calls the db.execute exampleCreate = -> db.execute "CREATE TABLE snacks (name TEXT(25), flavor TEXT(25))", (exeErr, rows) -> throw exeErr if exeErr exampleInsert() exampleInsert = -> db.execute "INSERT INTO snacks (name, flavor) VALUES ($name, $flavor)", { $name: "Potato Chips", $flavor: "BBQ" }, (exeErr, rows) -> throw exeErr if exeErr exampleSelect() exampleSelect = -> db.execute "SELECT name, flavor FROM snacks", (exeErr, rows) -> throw exeErr if exeErr console.log rows[0] # => { name: 'Potato Chips', flavor: 'BBQ' } # :memory: creates a DB in RAM # You can supply a filepath (like './example.sqlite') to create/open one on disk db.open ":memory:", (openErr) -> throw openErr if openErr exampleCreate() ~~~ ## 討論 你也可以事先準備好SQL語句: ~~~ sqlite = require 'sqlite' async = require 'async' # Not required but added to make the example more concise db = new sqlite.Database createSQL = "CREATE TABLE drinks (name TEXT(25), price NUM)" insertSQL = "INSERT INTO drinks (name, price) VALUES (?, ?)" selectSQL = "SELECT name, price FROM drinks WHERE price < ?" create = (onFinish) -> db.execute createSQL, (exeErr) -> throw exeErr if exeErr onFinish() prepareInsert = (name, price, onFinish) -> db.prepare insertSQL, (prepErr, statement) -> statement.bindArray [name, price], (bindErr) -> statement.fetchAll (fetchErr, rows) -> # Called so that it executes the insert onFinish() prepareSelect = (onFinish) -> db.prepare selectSQL, (prepErr, statement) -> statement.bindArray [1.00], (bindErr) -> statement.fetchAll (fetchErr, rows) -> console.log rows[0] # => { name: "Mia's Root Beer", price: 0.75 } onFinish() db.open ":memory:", (openErr) -> async.series([ (onFinish) -> create onFinish, (onFinish) -> prepareInsert "LunaSqueeze", 7.95, onFinish, (onFinish) -> prepareInsert "Viking Sparkling Grog", 4.00, onFinish, (onFinish) -> prepareInsert "Mia's Root Beer", 0.75, onFinish, (onFinish) -> prepareSelect onFinish ]) ~~~ [SQLite版的SQL](http://www.sqlite.org/lang.html)和[node-sqlite模塊文檔](https://github.com/orlandov/node-sqlite#readme)提供了更完整的信息。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看