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

Add INSERT function for SQL #187

Open
LarsArtmann opened this issue Feb 17, 2020 · 0 comments
Open

Add INSERT function for SQL #187

LarsArtmann opened this issue Feb 17, 2020 · 0 comments
Labels

Comments

@LarsArtmann
Copy link
Member

fun SQL.insertInto(tableName: String, values: Map<String, Any?>) {
    val queryKeys = values.keys.joinToString()
    val queryValues = values.values.joinToString(prefix = "'", postfix = "'")
    val statement = "INSERT INTO $tableName ($queryKeys) VALUES ($queryValues)"
    updateSync(statement)
}
@LarsArtmann LarsArtmann changed the title Add InSERT function for SQL Add INSERT function for SQL Feb 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant