sougatabh / hog Goto Github PK
View Code? Open in Web Editor NEWSimple JDBC Framework to return JSON Data from Database
Simple JDBC Framework to return JSON Data from Database
If a calling method receives exception instead of empty jSON string ( which is most cases ) in the event that no results found for a search criteria, following code might break!
Class : DBUtils.java
if(rs == null){
throw new DBException("No data found in the resultset");
Case 1 : in case of HTTP calls, if response content type is jSON ( application/jSON), response body should contains jSON string( expected ); we may have to handle this situation.
Note: The issue which I reported may not be a valid, if the user of this code wants to handle the exception in his own way.
Something like below will do...
f(rs == null){
return "{}";
}
or
f(rs == null){
return "{"result","no results found!"}";
}
Nulls not handled properly for empty records( unless primary key setup ) and columns with empty value.
Let's say user wants see in nested structure; can you please find list of students exam data in all subjects?
Ofcourse the records in following makes sense!
{"1":{"history":"30","maths":"50"},"2"....etc...
Sorry I am bit lazy in typing.this is just an example .
Framework should provide such flexibility-how to make user happy?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.