Created
August 7, 2013 19:09
-
-
Save paschmann/6177417 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function executeRecordSetObj(SQL){ | |
var conn = $.db.getConnection(); | |
var pstmt = conn.prepareStatement(SQL); | |
var rs = pstmt.executeQuery(); | |
var rsm = rs.getMetaData(); | |
var strObj = ''; | |
while (rs.next()) { | |
strObj += '{'; | |
for (var i = 1; i <= rsm.getColumnCount(); i++){ | |
strObj += '"' + rsm.getColumnName(i) + '":"' + rs.getString(i) + '",'; | |
} | |
strObj = strObj.substring(0, strObj.length - 1); | |
strObj += '},' | |
} | |
rs.close(); | |
pstmt.close(); | |
conn.close(); | |
return '[' + strObj.substring(0, strObj.length - 1) + ']'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment