Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support using input variable in more than one place in query (and w/ null) #28

Open
uladkasach opened this issue Jul 12, 2020 · 1 comment
Labels
blocker Blocks an in scope use case until completed bug Something isn't working

Comments

@uladkasach
Copy link
Member

right now, duplicate usage of input variable -> duplicate row in type def


export interface SqlQueryFindAllLatestInput {
  city: SqlTableLocation['city'];
  city: SqlTableLocation['city'];
  state: SqlTableLocation['state'];
  state: SqlTableLocation['state'];
  postal: SqlTableLocation['postal'];
  postal: SqlTableLocation['postal'];
}

from

  where 1=1
    and (
      :city is null
      OR
      :city = l.city
    )
    and (
      :state is null
      OR
      :state = l.state
    )
    and (
      :postal is null
      OR
      :postal = l.postal
    )

we can just check that they're all equivalent and only output the first one if so. (maybe throw an error if not? or just don't dedupe and warn user - and they can decide? (second option is better because it does not block user))

@uladkasach uladkasach added blocker Blocks an in scope use case until completed bug Something isn't working labels Jul 12, 2020
@uladkasach
Copy link
Member Author

actually, in this case, we should have generated

export interface SqlQueryFindAllLatestInput {
  city: SqlTableLocation['city'] | null;
  state: SqlTableLocation['state'] | null;
  postal: SqlTableLocation['postal'] | null;
}

so this may be the bigger problem that needs resolved

@uladkasach uladkasach changed the title support using input variable in more than one place in query support using input variable in more than one place in query (and w/ null) Jul 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocker Blocks an in scope use case until completed bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant