Posts

Showing posts with the label null

MySql function returns null everytime

MySql function returns null everytime I have the following function: (The SQL query works perfectly) CREATE FUNCTION get_participantes (pid INT) RETURNS varchar(255) DETERMINISTIC BEGIN DECLARE par varchar(255); SET par = (SELECT GROUP_CONCAT(mail SEPARATOR ',') FROM users WHERE id IN ( SELECT user_id FROM meeting_participants WHERE meeting_id = pid)); RETURN par; END And I'm trying to get the return of that function in the following procedure: CREATE PROCEDURE google_calendar (p1 varchar(50), p2 INT, p3 varchar(50), p4 varchar(50), p5 varchar(50), p6 varchar(50), p7 varchar(50), p8 varchar(50)) BEGIN DECLARE parti VARCHAR(255); SET @parti = get_participantes(p2); SELECT COALESCE(@parti,"nullpart") INTO @par2; SET @cmd = CONCAT('curl "http://*****:80**/meetings/api/" --data-urlencode "id=',p1,'" --data-urlencode "participants=',@par2,'" --data-urlencode "age...

Read a message character by character from keyboard and store in an array up to 256 characters

Read a message character by character from keyboard and store in an array up to 256 characters I'm coming here with another question because I've ran into a snag and haven't been able to figure out what the issue is.. My problem: Create an array of 256 characters, and read a message character by character from keyboard and store them in the array up to 256 symbols. The method should return number of the characters stored in the array. Then pass the array to another method to print each word of the message in a line. My attempted solution: public static void main(String args){ char arrItem7 = new char[256]; readArray(arrItem7); printOneInLine(arrItem7); } public static char getMsg(){ String myMessage; System.out.print("Input Message: "); Scanner input = new Scanner(System.in); myMessage = input.nextLine();// Read a line of message return myMessage.toCharArray(); } public static char readArray(char arr){ arr = getMsg(); retu...