Sql working

This commit is contained in:
10001shh
2018-07-03 17:16:07 -05:00
parent 330bdc89b0
commit 4f31b3e963
5 changed files with 88 additions and 6 deletions

View File

@@ -1,4 +1,11 @@
$(document).ready( function() {
sql = window.SQL;
loadBinaryFile('grades.db', function(data){
var sqldb = new SQL.Database(data);
// Database is ready
var res = sqldb.exec("SELECT * from agg where dept like '%C S%' and course_nbr like '%314%'");
console.log(res[0].values);
});
$("table thead th:nth-child(5)").after('<th scope=col>Rating</th>');
$('table').find('tr').each(function(){
var rating;
@@ -9,17 +16,44 @@ $(document).ready( function() {
rating = "No Prof :(";
} else {
console.log(profurl);
//getProfessorTID();
//getProfessorFullName(profurl);
console.log(profname);
// console.log(lastname[0]);
rating = "Hello";
}
$(this).find('td').eq(4).after('<td data-th="Rating"><a href="http://example.com">'+rating+'</a></td>');
});
});
function loadBinaryFile(path,success) {
var xhr = new XMLHttpRequest();
xhr.open("GET", chrome.extension.getURL(path), true);
xhr.responseType = "arraybuffer";
xhr.onload = function() {
var data = new Uint8Array(xhr.response);
var arr = new Array();
for(var i = 0; i != data.length; ++i) arr[i] = String.fromCharCode(data[i]);
success(arr.join(""));
};
xhr.send();
};
// function getProfessorTID(profname) {
// var name = profname.split(',');
// var lastname = profname[0];
// var firstinit = profname[1].substring(1);
// console.log(lastname + " "+firstinit);
function getProfessorFullName(profurl){
}
// return new Promise((resolve, reject) => {
// chrome.runtime.sendMessage({
// method: "POST",
// url: "http://www.ratemyprofessors.com/search.jsp",
// data: "queryBy=teacherName&schoolName=university+of+texas+at+austin&query="+profname+"&facetSearch=true"
// }, function(response) {
// if (response) {
// console.log(response);
// }
// });
// });
// }
//http://www.ratemyprofessors.com/search.jsp?queryBy=teacherName&schoolName=university of texas at austin&query="+url+"&facetSearch=true"