Timestamp Field is always returned as {} when connected to mysql through jaggery

65 Views Asked by At

Below is the code used

config={};
var dataSource = new Database("jdbc:mysql://localhost:3306/mydb","root","root",config);
result=dataSource.query("select * from testtable");
print(result);

The response i received is

[{  
  "count":3,
  "site":"Site 2",
  "bank":"Bank 2",
  "size":"SMALL",
  "transactionDate":{  

  }
},
{  
  "count":2,
  "site":"Test Site",
  "bank":"Test Bank",
  "size":"SMALL",
  "transactionDate":{  

  }
},
{  
  "count":15,
  "site":"Site 2",
  "bank":"Bank 2",
  "size":"",
  "transactionDate":{  

  }
}]

Notice the transactionDate field [ DataType timestamp]. It is always returned as {} but the field has data for each record in the table. The data for transactionDate looks like : 2014-07-03 00:00:00 2014-07-04 00:00:00 2014-07-05 00:00:00

1

There are 1 best solutions below

0
On

You could change your SQL to have all fields from testtable and use for timestamp:

..,CAST(timestamp AS CHAR) AS timestamp,..

Or you create a view where timestamp is converted already to avoid listing all fields in your code.