Hi, is there a way that i can get the username and hostname in a macro?
I want to stamp the user@hostname on some records.
For the username i can get it from
Form.ActiveConnection.Parent.User (if i remember it right.)
But for the hostname , i couldn't find it anywhere on the xRay.
Thanks!
[Solved] Base Mysql get username + hostname
[Solved] Base Mysql get username + hostname
Last edited by ponlerd on Fri Apr 30, 2010 4:25 am, edited 1 time in total.
OOo 3.2 Ubuntu 9.04 / OOo 3.2 Windows7 / Migrating from Access
Re: Base Mysql get username + hostname
You use MySQL in your title and the format user@hostname sounds like MySQL as well.
So my advice is: "Ask the database for this information:"
If I do the same inside a query in Base on my Windows machine connected to a MySQL database on a Linux Box I get: rolf@grappa.ristaurante.local as the resulting record.
Actually this is information about the client side of the connection. But as you say you need to stamp it, the client machine makes much more sense than the host name with the mysql server.
update this_table set changed_by = user() where ....
And see the Mysql manual in case you need other types of session data.
So my advice is: "Ask the database for this information:"
Code: Select all
mysql> select user();
+----------------+
| user() |
+----------------+
| rolf@localhost |
+----------------+
Actually this is information about the client side of the connection. But as you say you need to stamp it, the client machine makes much more sense than the host name with the mysql server.
update this_table set changed_by = user() where ....
And see the Mysql manual in case you need other types of session data.
OpenOffice 3.1.1 (2.4.3 until October 2009) and LibreOffice 3.3.2 on Windows 2000, AOO 3.4.1 on Windows 7
There are several macro languages in OOo, but none of them is called Visual Basic or VB(A)! Please call it OOo Basic, Star Basic or simply Basic.
There are several macro languages in OOo, but none of them is called Visual Basic or VB(A)! Please call it OOo Basic, Star Basic or simply Basic.
Re: Base Mysql get username + hostname
Thanks , works great!
OOo 3.2 Ubuntu 9.04 / OOo 3.2 Windows7 / Migrating from Access