Created
November 14, 2018 14:37
-
-
Save Manuri/a3bb78235cd6f9fcdc6158fdb9b4a940 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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