Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DL 18.1: boolean settings for postgres backend broken #71

Open
wavexx opened this issue Jan 27, 2018 · 2 comments
Open

DL 18.1: boolean settings for postgres backend broken #71

wavexx opened this issue Jan 27, 2018 · 2 comments

Comments

@wavexx
Copy link
Member

wavexx commented Jan 27, 2018

Reported by Dima Veselov:

Main problem is that PostgreSQL unlike others do not accept boolean as 1 or 0 - only as true or false.

I managed to make this work changing code to: ticketfunc.php:122
$sql .= ", " . (!isset($params["pass_send"])? 'false': to_boolean($params["pass_send"]));

func.php:

function to_boolean($v)
{
  if($v === 1 || $v === "1" || $v === "true") {error_log("FIRE
$v");return "true";}
  elseif($v === 0 || $v === "0" || $v === "false" || $v === FALSE)
return "false";
  return null;
}

Sorry, can't check if this break other database logic. Also,
dbupgrade.php should be remastered, I executed it manually.

@wavexx wavexx changed the title DL 18.1: boolean settings for postgress backend broken DL 18.1: boolean settings for postgres backend broken Jan 27, 2018
@wavexx
Copy link
Member Author

wavexx commented Feb 27, 2018

I wonder how this ever worked, honestly. To my dismay, given how (fake) booleans interact with mysql and sqlite, I'll actually change the column type in postgres to a smallint to gain uniform behavior.

@jenszahner
Copy link

Could you be so kind to take a look at #73 for type safety during sql statements.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants