The Wayback Machine - https://web.archive.org/web/20210724223052/https://github.com/dimitri/pgloader/pull/1209
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

Progress 4GL logical field support #1209

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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 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

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

@@ -500,6 +503,9 @@
"Convert a DB3 logical value to a PostgreSQL boolean."
(if (member value '("?" " ") :test #'string=) nil value))

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

This comment has been minimized.

@dimitri

dimitri Oct 19, 2020
Owner

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

@@ -500,6 +503,9 @@
"Convert a DB3 logical value to a PostgreSQL boolean."
(if (member value '("?" " ") :test #'string=) nil value))

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

This comment has been minimized.

@dimitri

dimitri Oct 19, 2020
Owner

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))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment