SQL syntax error with

Ask community to help.

Moderators: Amaradana, TurboPT, TL Developers

SQL syntax error with

Postby gcomeau » Wed Feb 06, 2019 9:15 pm

There is an issue with the newest version of mysql and the syntax of the softwares queries.

To get around this I modified the php code in installUtils.php

Code: Select all
// 20070310 - $the_host -> $db_host       
if (strlen(trim($db_host)) != 0)
{
  $stmt .= "@" . "'" . $dbhandler->prepare_string($db_host) . "'";
}         
$stmt .= " IDENTIFIED BY '" .  $passwd . "'"; // this is bad


Should be:

Code: Select all
   // 20070310 - $the_host -> $db_host       
if (strlen(trim($db_host)) != 0)
{
  $stmt .= "@" . "'" . $dbhandler->prepare_string($db_host) . "'";
}         
// $stmt .= " IDENTIFIED BY '" .  $passwd . "'"; // this is good


And:

i
Code: Select all
f( strcasecmp('localhost',$db_host) != 0)
  {
    // 20060514 - franciscom - missing
    $stmt = "GRANT SELECT, UPDATE, DELETE, INSERT ON " .
             "`" . $dbhandler->prepare_string($db_name) . "`" . ".* TO " .
             "'" . $dbhandler->prepare_string($login) . "'@'localhost'" .
            " IDENTIFIED BY '" .  $passwd . "'"; // this is bad
    if ( !@$dbhandler->exec_query($stmt) )
    {
      $op->msg = "ko - " . $dbhandler->error_msg();
      $op->status_ok=false;
    }
  }
}


Should be:

Code: Select all
if( strcasecmp('localhost',$db_host) != 0)
  {
    // 20060514 - franciscom - missing
    $stmt = "GRANT SELECT, UPDATE, DELETE, INSERT ON " .
             "`" . $dbhandler->prepare_string($db_name) . "`" . ".* TO " .
             "'" . $dbhandler->prepare_string($login) . "'@'localhost'"; // this is good
    if ( !@$dbhandler->exec_query($stmt) )
    {
      $op->msg = "ko - " . $dbhandler->error_msg();
      $op->status_ok=false;
    }
  }
}
gcomeau
TestLink user
 
Posts: 8
Joined: Wed Feb 06, 2019 6:06 pm

Re: SQL syntax error with

Postby fman » Thu Feb 07, 2019 5:27 pm

Hi
thanks.
It would be better for issues to open it on mantis.testlink.org, and if possible provide a Pull Request .
Would you mind to provide MySQL version you are using ?

Important thing is that syntax need to be backward compatible and MariaDB compatible
fman
Member of TestLink Community
 
Posts: 3063
Joined: Tue Nov 15, 2005 7:19 am

Re: SQL syntax error with

Postby gcomeau » Thu Feb 07, 2019 5:40 pm

fman wrote:Hi
thanks.
It would be better for issues to open it on mantis.testlink.org, and if possible provide a Pull Request .
Would you mind to provide MySQL version you are using ?

Important thing is that syntax need to be backward compatible and MariaDB compatible


Np, homie. I tried to sign up for an account there but was unable to do so. I would be happy to put a bug report there if I can get an account.

On a side note, we could check for DB version and adjust the syntax accordingly. Personally, I think testlink has a lot of potentials, but it should work with the latest version of mysql. How do I get an account with mantis.
gcomeau
TestLink user
 
Posts: 8
Joined: Wed Feb 06, 2019 6:06 pm

Re: SQL syntax error with

Postby fman » Thu Feb 07, 2019 6:04 pm

latest MySQL version means 8?

only issue with mantis user creation can be that you do not receive the confirmation email, is that what has happened to you ?
what user name have you used ?
fman
Member of TestLink Community
 
Posts: 3063
Joined: Tue Nov 15, 2005 7:19 am

Re: SQL syntax error with

Postby gcomeau » Fri Feb 08, 2019 3:59 pm

Ok, so I was able to sign-up with the same credentials, I will post my findings as a bug report on mantis.
gcomeau
TestLink user
 
Posts: 8
Joined: Wed Feb 06, 2019 6:06 pm


Return to Installation and configuration



Who is online

Users browsing this forum: Google [Bot] and 3 guests