I have a mySQL database which I've connected to through google sheets using JDBC. In my spreadsheet, I have a list of hashtags and number of times which that hashtag was mentioned that day. Each one of these hashtags is already stored in a table in the databse.
When I try to query the Integar value for a specific hashtags ID number - the value returns as 'true' instead of returning as a number.
If I run the same query outside of app script - it returns the number? I don't understand why. I've tried messing around with the syntax but nothing helps.
.
The spreadsheet is layed out:
Col A: Hashtag
Col B: Number times mentioned
.
The table in the Database is:
Col 1: Hashtag_ID (Int / PK)
Col 2: Hashtag (VarChar)
.
The idea is to track hastag mentions daily.
I'm really stuck with this. It makes no sense.
Thanks in advance.
var conn = Jdbc.getCloudSqlConnection(dbUrl, user, userPwd); //JDBC connection to DB
var Htag = sheet.getRange('A2').getValue(); //String - Hashtag Text
var HashtagID = conn.createStatement().execute('SELECT id FROM HashtagTable WHERE Hashtag = "'+ Htag + '"');
Logger.log('Hashtag ID Number: ' + HashtagID); //Outputs result of query