Skip to content

Instantly share code, notes, and snippets.

@Manuri
Created November 14, 2018 14:37
Show Gist options
  • Save Manuri/a3bb78235cd6f9fcdc6158fdb9b4a940 to your computer and use it in GitHub Desktop.
Save Manuri/a3bb78235cd6f9fcdc6158fdb9b4a940 to your computer and use it in GitHub Desktop.
import ballerina/mysql;
import ballerina/io;
public type Employee record {
int id;
};
public function main(int arg) {
endpoint mysql:Client testDB {
host: "localhost",
port: 3306,
username: "root",
password: "123",
name: "testdb",
poolOptions: { maximumPoolSize: 5 },
dbOptions: { useSSL: false }
};
string sqlQuery = "select * from Employee where id =" + arg;
table<Employee> temp0 = check testDB -> select(sqlQuery, Employee);
foreach rec in temp0 {
io:println(rec.id);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment