Guest User

Untitled

a guest
Nov 14th, 2018
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. import ballerina/mysql;
  2. import ballerina/io;
  3.  
  4. public type Employee record {
  5. int id;
  6. };
  7.  
  8. public function main(int arg) {
  9. endpoint mysql:Client testDB {
  10. host: "localhost",
  11. port: 3306,
  12. username: "root",
  13. password: "123",
  14. name: "testdb",
  15. poolOptions: { maximumPoolSize: 5 },
  16. dbOptions: { useSSL: false }
  17. };
  18.  
  19. string sqlQuery = "select * from Employee where id =" + arg;
  20.  
  21. table<Employee> temp0 = check testDB -> select(sqlQuery, Employee);
  22.  
  23. foreach rec in temp0 {
  24. io:println(rec.id);
  25. }
  26. }
Add Comment
Please, Sign In to add comment