Launching from command line
I don't think there is such an option at the moment, and as far as I know no other MySQL GUI out there has that option (both open-source and commercial).
This feature is really a "must have" when servers you connect to, or their params, change often. It gets really tiresome to update connection params in multiple programs all the time so I've created a small app that enables me to keep all connection information in one XML file and use that app to launch any other program passing it appropriate parameters. This works like a charm for PuTTy and WinSCP, but I can't find a MySQL GUI that will accept connection parameters on command line.
If this feature is not available in HeidiSQL right now, does it sound like feature worth implementing in foreseeable future?
Thanks for HeidiSQL! I've been using MySQL-Front since early 2.X days and always found any other tool to be lacking some features or just too weird to use. I guess it just gets under your skin. :D
Just let us gather needed parameters here:
- host
- user
- pass
- port
- maybe a database name to use?
So it could look like
heidisql.exe -hLocalhost -uUser -pPassword -db
We could even simulate the mysql-cli's behaviour which is quite good:
either
- use a given password from "-p" and connect immediately
- if an empty password given, ask for it and don't connect immediately
- if no -p parameter given, assume we have to connect with an empty password
How does that sound?
Oh that sounds easy to implement. Just look for given parameters on startup (and connect automatically instead of waiting for the user to click "Connect"?)
Exactly that.
Just let us gather needed parameters here:
- host
- user
- pass
- port
- maybe a database name to use?
I would definitely find db name useful, plus I think there should be an optional description parameter so if there are multiple instances of Heidi open, you can easily find the right one in task bar. This description should behave exactly the same as "Description:" in connection dialog.
So it could look like
heidisql.exe -hLocalhost -uUser -pPassword -db
We could even simulate the mysql-cli's behaviour which is quite good:
either
- use a given password from "-p" and connect immediately
- if an empty password given, ask for it and don't connect immediately
- if no -p parameter given, assume we have to connect with an empty password
How does that sound?
Puts a big smile on my face. :D
But: I started to implement that a few weeks ago and then stopped it for the benefit of other implementations. Maybe the code I wrote is useful and helps me implementing it soon.
And: I'm on the way to create a workflow for compiling nightly builds. Will need some more days or maybe 2 weeks.
...
-B
-I"components\zeosdbo\src\core"
...
Won't create the .DCU files here as expected. :cry:
Anyone with hints for me?
Perhaps the order of options is important? Did you try to specify include directives first?
Maybe you should just post you whole batch file here in hopes that someone will catch some sneaky little error in it.
Sorry, can't help you more with this issue.
Is msbuild something I have to download seperately?
http://download.heidisql.com/
http://fisheye3.cenqua.com/changelog/~rss/heidisql/trunk/rss.xml
Maybe you can help out with that feature?
I sure can try. I'm not a Delphi programmer, but if you think I can help you in some other way please let me know.
This is a long shot, but if there is some free or trial version of Delphi that I can use to build Delphi programs myself maybe I can try implementing command line parser by itself and if successful hand it over to you to integrate it into Heidi. Do you know of any such download?
I still think that copying mysql.exe behaviour for relevant command line parameters and adding --session="session name" option would be a good solution.
I will download the Turbo version and see if I can find my way around it.
I then tried to install the components manually, but that didn't work either. Even their demos that use third party components, like Indy, don't work because of components not installing. So I'm under the impression that free trial version also doesn't support installation of third party components, but I can't find any info on that. All in all, such a bad experience with Borland/CodeGear so far. Not to mention that documentation alone took well over an hour to install.
I am able to work on the command line parser with this trial version, so I'll see if I can get anywhere with it. I remember that I saw some free e-book on Pascal some time ago, but I can't google it now. Do you know of any free Pascal/Delphi language reference available online? Only RadStudio and VCL reference come with RadStudio 2007, but I could also use some language reference.
Off-topic: I'm not receiving notification emails for new post to topics that I am subscribed to. Are you aware of any problems with forum not mailing out notification emails?
And thanks a lot for the info about not receiving mails! It seems the mailserver doesn't do its job since we moved the website to our own virtual private server system.
I now have some code that can parse long parameters, see below for examples. Since ParamStr() returns AnsiString values, I used AnsiStr functions throughout. Is that going to be a problem in some situations?
This is parsed correctly:
heidisql.exe --user=root --host=192.168.1.1 --password --session="My session name"
Values are returned as expected, except for password in which case we know that --password is present but its value is set to empty string.But none of these will be parsed correctly at the moment:
heidisql.exe --user root --host 192.168.1.1 --password --session "My session name"
heidisql.exe -uroot -h192.168.1.1 -p -s"My session name"
heidisql.exe -u root -h 192.168.1.1 -p -s "My session name"
First one is, I think, not really accepted by mysql.exe either?Second one could probably be made to work with not too much effort, if need be.
But last one would require some substantial changes, though still doable if really required.
That is what I wanted to discuss, what formats exactly are we looking to support? Long options as they work now in my first example above are good enough for me, but I'd like to hear what others think.
If I manage to compile Heidi, what would be the best place for this code/logic? Where in childwin, OnCreate? Or some other place?
Regarding your question where to put that code: I think that's a quite complex thing. Normally Tconnform initializes the mysql connection and creates a TMDIChild. In this case we don't need Tconnform, so TMainform.FormShow should do the connect instead of passing all responsibility to TMainform.ShowConnections() + Tconnform.ButtonConnectClick(). I think we should move some code from Tconnform.ButtonConnectClick() to main.pas, call that from both places (command line passed parameters AND Tconnform.ButtonConnectClick() ).
However, once it's ready I think you should send the code snippet to heidisql-devel ...at... lists.sourceforge.net so I can discuss that with the other developers.
Yes, connection logic should be moved to main.pas somewhere and act upon passed parameters, regardless of where they're coming from.In this case we don't need Tconnform, so TMainform.FormShow should do the connect instead of passing all responsibility to TMainform.ShowConnections() + Tconnform.ButtonConnectClick(). I think we should move some code from Tconnform.ButtonConnectClick() to main.pas, call that from both places (command line passed parameters AND Tconnform.ButtonConnectClick() ).
In case of --password or -p user will need to be prompted for a password. This will probably be better done from where ever the startup params are parsed and before the connect function is called.
Preferably that prompt will be a very simple modal dialog with a label like "Enter password for user@host", a password box below and OK Cancel buttons on the bottom.
I'll be mailing the code to devel list right away.
btw. I just received 4 notification emails, so it seems your mail server is working now.
However, I'll start to get it in asap. I'm working on replacing the two datagrids by TNT components, but that's nearly ready, so just gimme a week or so.
Only the CRLF constant already lives in const.inc but that's a minor thing.
I've only put that in so I can print the results of parsing, plus I did that as a standalone project so I didn't have access to heidisql files. But that won't be needed in heidi anyway, since heidi will not just print those to some message box
However, I'll start to get it in asap. I'm working on replacing the two datagrids by TNT components, but that's nearly ready, so just gimme a week or so.
Great! I'm looking forward to it.
If you remember, please update this post once that code is available in nightly build.
Download nightly build here in 20 minutes.
A big, big thanks goes to Nemanja! 8)
Btw, the wrapper function MyParam was not really needed and I dropped it. You got this error "Missing operator or semicolon" because there was a variable paramStr which conflicts with a function of the same name. I just renamed the variable and it worked.
OK, great. I couldn't really figure out what the error was about, so I put it in a wrapper function and the worked, so...
Even though I should have noticed that, I wouldn't really call the error message "descriptive". :)
Done in revision 1155.
Download nightly build here in 20 minutes.
Ansgar,
thank you very much for this one. And Heidi in general, of course. :D
I just did a quick test, and it seems to work perfectly. Thanks so much!
I think you should "advertise" this feature of Heidi a bit more since, as far as I know, this is the only MySQL GUI tool that has this capability. On any platform, not just windows. Again, this is only AFAIK. Though I did do fair bit of research on the subject. By "advertise", I mean something like mention it in a feature list and README, etc.
btw. I never told you how awesome your nightly builds system is. I really like how you put it together like a generally useful AND usable service, instead of just a dump of latest code in executable form. Great work on that as well!
It doesn't even connect to single database, but I am talking about this http://prntscr.com/lob9hc I understand heidisql.exe -d=sessionname works for my case but it will more perfect If I could be able to connect using user,pass,host,dbs in cli
however thank you for your quick response :)
Ah ok, in that case I'm afraid there is no command line switch to limit the database names you want to see.
There are just too many options in the session manager to make them all available on the command line, and most of them are never important for most users. Also, keep in mind that HeidiSQL is a GUI.
As a workaround, you could create the relevant session key by yourself, under \\HKEY_CURRENT_USER\Software\HeidiSQL\Servers
, and after that use the -d=sessionname
parameter on the command line.
I tried this http://prntscr.com/lofhki but its not appear in heidisql session manager and also can't connect via -d=sessionname ...
when I make session from heidisql gui, I can connect via -d=sessionname in cli
HERE is my real problem
Please see this screenshot http://prntscr.com/lofj7w ... it seems like -d=sessionname args need somewhere in global scope etc. Any help will be appreciated :)
that is working in cmd, not sure why not working for my tool, here is documentation https://atom.io/docs/api/v1.11.2/BufferedProcess , all other are working fine, only heidisql command with args is not working there.
Please login to leave a reply, or register at first.