Skip to content

Connect user and password const? #211

Open

Description

@EdwinGH

In my Arduino code I am defining:
const char* mysql_user= "user";
Using const as best practice for defining strings this way (and to prevent compiler warnings like ISO C++ forbids converting a string constant to 'char*').
When calling
conn.connect(mysql_server, 3306, mysql_user, mysql_password)
I get a compiler error:
error: invalid conversion from 'const char*' to 'char*'

I looked at the signature of connect:
boolean MySQL_Connection::connect(IPAddress server, int port, char *user, char *password, char *db)
And I wonder why user, password, and db are not defined as const char, as I do not see them changed anywhere.
Any suggestions how to best solve this?

Activity

  1. ChuckBell commented on May 18, 2023

    @ChuckBell
    Owner
  2. ChuckBell commented on May 18, 2023

    @ChuckBell
    Owner
  3. EdwinGH commented on May 20, 2023

    @EdwinGH
    Author

    I have made a fork, did the proposed changes, checked that it solves the issue, and submitted the pull request. First time I'm doing this (thanks for encouraging me!), so not sure what happens next. On my side things are working, so happy anyway!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions