Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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);
- }
- }
Add Comment
Please, Sign In to add comment