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

Feedback on Connector-bash #2

Open
ngirard opened this issue Aug 1, 2023 · 5 comments
Open

Feedback on Connector-bash #2

ngirard opened this issue Aug 1, 2023 · 5 comments

Comments

@ngirard
Copy link
Contributor

ngirard commented Aug 1, 2023

Hey Félix,

I recently came across your project while looking for a robust way to interact with an SQLite database from Bash. I found your codebase to be a promising starting point and made a series of changes resulting in PR #1 that I just submitted.

I wanted to reach out to you to ask if you think the changes in the pull request are going in the right direction for this project.
I made sure that none of the changes break compatibility with the existing code, but I am also considering making deeper changes that would break compatibility, such as renaming the functions, adding a prefix as a namespace, or changing the functions' implementation.

I would like to know if you would welcome such kind of changes or if I should keep them as a separate project. I would appreciate any feedback you have on this matter.

Thank you for your time and for sharing your code !

Cheers

@F-Hauri
Copy link
Owner

F-Hauri commented Aug 1, 2023

Hi,

Well done and yes, you're improvement are going on the right way!

Sorry for the lack of documentation and bravo for your brain work!
(especially against near useless random 15 bits decomposition in mkbound function !)

The only wrong thing is: Add timeout when reading to STDERR, as read -t 0 don't read nor wait! From man page:

If timeout is 0, read returns immediately, without trying to read any data. The exit status is 0 if input is available on the specified file descriptor, or the read will return EOF, non-zero otherwise.

The bad news now: Unfortunately all my project are freezed here! Consecutively to last propetary change and because of my knowing about his meaning of the ethic word.

Newer version is only shared on my bazar folder: https://f-hauri.ch/vrac/shell_connector.sh.txt
...while looking for a strong and reliable new git hoster...

Feel free to send me a mail at [email protected] en français ;-)

@ngirard
Copy link
Contributor Author

ngirard commented Aug 1, 2023

Well done and yes, you're improvement are going on the right way!

Thanks !

(especially against near useless random 15 bits decomposition in mkbound function !)

... which I planned to suggest you to replace with e.g. reading /dev/urandom if it suits you.

read -t 0 don't read nor wait!

Indeed, I noticed that inbetween. In another commit later I dropped all the if read -t 0, but kept in mind that it might be the less ugly way of checking the status of a file descriptor, so I was thinking about reintroducing that when dealing with improving error handling.

Newer version is only shared on my bazar folder: https://f-hauri.ch/vrac/shell_connector.sh.txt

Yes, I examined that version and unless mistaken, the only valuable addition was the ability to perform e.g. echo "SELECT * FROM table_name" | mySqlReq result, which I backported as another commit.

The bad news now: Unfortunately all my project are freezed here! Consecutively to last propetary change and because of my knowing about his meaning of the ethic word.

I'm not sure I understand : what does it impy with respect to this first PR of mine and of possible contributions ? I was expecting to leverage GitHub CI to add automated testing and packaging.

@F-Hauri
Copy link
Owner

F-Hauri commented Aug 1, 2023

... which I planned to suggest you to replace with e.g. reading /dev/urandom if it suits you.

mkbound() { 
    local -n result=${1:-bound};
    local _out _arry=({a..z} {A..Z} {0..9} _ @);
    printf -v _out '%s' ${_arry[RANDOM%64]}{,,,,}{,,}{,};
    printf -v result -- "--%s-%s-%s-%s-%s-%s-" ${_out:0:7} \
        ${_out:7:4} ${_out:11:4} ${_out:15:4} ${_out:19:4} ${_out:23}
}

what does it impy...

I've decided that I won't continue to supply ms's ai with thing outgoing from my brain.
I'ts the reason I won't publish here.

I'm ok that you or another humain play and even learn from my code.
Ready to discuss via mail or some IRC, maybe, but not @ms!

@F-Hauri
Copy link
Owner

F-Hauri commented Aug 28, 2023

@ngirard Re-reading your edit (and retro edit them), It seem you'd not understand $lastsqlread meaning.
This should be the answer of (in mariadb SQL):
SELECT UNIX_TIMESTAMP() AS $bound;

should look like:
$bound
1693123456

So once loop encounter $bound, mySql function must to read 1 more line: $lastsqlread which hold timestamp of last answer.

@F-Hauri
Copy link
Owner

F-Hauri commented Aug 28, 2023

@ngirard ... and sqlreqbound is not a bondary string, it's a request asking for current time as UNIX EPOCH, titled by boundary string.

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