ashleygwilliams / ashleygwilliams.github.io

hi, i'm ashley. nice to meet you.
http://ashleygwilliams.github.io/
82 stars 20 forks source link

two queries made when returning a collection #13

Closed ashleygwilliams closed 9 years ago

ashleygwilliams commented 9 years ago

e.g. GET /writing

{ __cid: '__cid2',
  method: 'columnInfo',
  options: undefined,
  bindings: [],
  sql: 'PRAGMA table_info(writing)',
  output: [Function] }
{ __cid: '__cid2',
  method: 'select',
  options: undefined,
  bindings: [],
  sql: 'select "writing".* from "writing"' }

not sure if this is expected? mostly wondering what the first query actually does and if it is necessary for the response? don't think it is, but am unsure? @tkellen ?

tkellen commented 9 years ago

This happens once per model and is cached (to populate the known columns for the table): https://github.com/endpoints/endpoints/blob/master/src/adapter-bookshelf/index.js#L235-L241

ashleygwilliams commented 9 years ago

good to know. thanks for answering :heart: