pgjdbc/pgjdbc GitHub issues and pull requests (mirror)  
help / color / mirror / Atom feed
From: crowmagnumb (@crowmagnumb) <[email protected]>
To: pgjdbc/pgjdbc <[email protected]>
Subject: Re: [pgjdbc/pgjdbc] PR #3396: SQLData Support
Date: Fri, 10 Jan 2025 21:42:23 +0000
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

> Please note that this piece of code probably doesn't work the way you expect
> 
> ```
>         if (isWhitespace(ch)) {
>           ++charIdx;
>           while (charIdx < len && isWhitespace(value.charAt(charIdx))) {
>             ++charIdx;
>           }
>           break;
>         }
> ```
> 
> You can run the method on such a line, for example, and verify this:
> 
> ```
> "(   "a"    ,   "b"   ,    "c"    )"
> ```
> 
> This code should find the index of the next non-whitespace character and call cotninue.
> 
> And there is no need for a go-to label in this method. You can do without the label in readString too by replacing switch with if-else

You are absolutely right. This parsing code I more or less got from the impossibl driver since I knew that it worked. I really didn't analyze it too much because it works for what postgresql gives you. But yeah, I'll clean it up. Cheers.
I think it works just fine because postgresql doesn't give you any whitespace (no surprise there, why waste bytes on whitespace?). So tecnically we could probably just remove that check. But maybe best to have just in case? But make it work correctly.  :)

view thread (67+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: github://pgjdbc/pgjdbc
  Cc: [email protected], [email protected]
  Subject: Re: [pgjdbc/pgjdbc] PR #3396: SQLData Support
  In-Reply-To: <<[email protected]>>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox