Skip to content
This repository was archived by the owner on Jul 1, 2026. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: TryGhost/node-sqlite3
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: cyjake/node-sqlite3
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 1 commit
  • 14 files changed
  • 1 contributor

Commits on Nov 1, 2018

  1. New: db.all({ sql, nestTables: true }), fixes #443

    This commit changes the Statement callback footprint from `function(err,
    result)` to `function(err, result, fields)`. The default result
    structure is changed from `{ field1: value1, field2: value2 }` to
    `[ value1, value2 ]` to be compliant with the fields array.
    
    The newly added fields is in such format:
    
    ```js
    [ { name: 'field1', table: 'table1' },
      { name: 'field2', table: 'table1' } ]
    ```
    
    In this way, when a JOIN query like `SELECT foo.*, bar.* ...` happens,
    the values in result won't be collided with each other. And the result
    can be properly processed with the help of fields.
    
    To be backward compliant, `Database.prototype.[get|all]` are overriden.
    The default `.all(sql, callback)` still works the same, with the result
    containing objects. The added method type is `.all({ sql, nestTables })` in
    which the `nestTables` is default to false.
    
    If `nestTables` is true, the returned `rows` is an array of nested objects
    in following structure:
    
    ```js
    [ { table1: { field1: value1, field2: value2 },
        table2: { ... } },
      { table1: { ... },
        table2: { ... } } ]
    ```
    cyjake committed Nov 1, 2018
    Configuration menu
    Copy the full SHA
    3a04fb0 View commit details
    Browse the repository at this point in the history
Loading