Skip to content

Conversation

@wsuchy
Copy link

@wsuchy wsuchy commented Sep 12, 2020

When creating a dump from OpenEdge (Progress) database, boolean fields will contain the following values:

  • "yes" - true
  • "no" - false
  • "?" - null. I am assuming that everything else than yes/no is null here.

@dimitri
Copy link
Owner

dimitri commented Oct 19, 2020

Hi, thanks for the Pull Request! Can you check if we need to return strings for this transformation? and if we must return strings, can we return "t" and "f" instead of digits?

Copy link
Owner

@dimitri dimitri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you willing to update the PR for me to merge it?


(defun progress-logical-to-boolean (value)
(if (string= value "yes") "1" (if (string= value "no") "0" nil))
)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please close all the parens on the same line. In Lisp closing parens have no semantics attached to them.

(if (member value '("?" " ") :test #'string=) nil value))

(defun progress-logical-to-boolean (value)
(if (string= value "yes") "1" (if (string= value "no") "0" nil))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A more lispy way to write the same thing, easier to maintain and read, is the following:

(cond ((string-equal value "yes") "1")
      ((string-equal value "no")  "0")
      (t nil))

@dimitri dimitri added Contribution Good First Issue This is a good way to contribute to pgloader for the first time Work In Progress labels Oct 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Contribution Good First Issue This is a good way to contribute to pgloader for the first time Work In Progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants