Skip to content

Prototype Simple Expression to SQL Translator #1

Description

@sgoguen

I'd like to approach this library by tackling some simple problems first to get a sense of how difficult the larger problems will be. First thing I'd like to do is translate expressions and constructs that have a relatively clear 1-to-1 mapping. For example:

A simple add function:

let add x y = x + y

Should translate into the following SQL code:

create function [add](@x int, @y int)
returns int
as
begin
    return(@x + @y)
end

An object based expression like so:

type BandMember = { Name:string; Position:string; DOB:System.DateTime }

let george = { Name="George Clinton"; Position="bandleader"; DOB=new System.DateTime(1941, 7, 22) }

Might translate to:

select 'George' As Name, 'bandleader' As Position, cast('7/22/1941' as datetime) As DOB

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions