PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.databases.mysql > How to know the current database you are in
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
How to know the current database you are in

Réponse
 
LinkBack Outils de la discussion
Vieux 18/10/2007, 12h24   #1
Water Cooler v2
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut How to know the current database you are in

Verion: 5.0.45-community-nt

What's the command for knowing the current database you are in. For
example:

a) mysql> show databases;

outputs:
1. foo
2. test
3. mysql

b) mysql> use foo;
Database changed

Is there a function or a global variable that will tell me the current
database I am in?

I KNOW THAT THE 'STATUS' command will, but it also comes up with a lot
of other stuff. Is there, like, an alternative command that just tells
you the name of the current database?

Everytime I forget if I am in the right database, I do a 'use foo'
thing, and it reports 'Database changed' always, even if I am in the
same database, which I find somewhat irritating and also ignorant on
my part.

How do I know which database I am sitting inside. I tried looking up
the manual but couldn't find something like CUR_DB or CURRENT_DB or
some such thing.

  Réponse avec citation
Vieux 18/10/2007, 12h25   #2
Water Cooler v2
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: How to know the current database you are in

On Oct 18, 11:24 am, Water Cooler v2 <wtr_...@yahoo.com> wrote:
> Verion: 5.0.45-community-nt
>
> What's the command for knowing the current database you are in. For
> example:
>
> a) mysql> show databases;
>
> outputs:
> 1. foo
> 2. test
> 3. mysql
>
> b) mysql> use foo;
> Database changed
>
> Is there a function or a global variable that will tell me the current
> database I am in?
>
> I KNOW THAT THE 'STATUS' command will, but it also comes up with a lot
> of other stuff. Is there, like, an alternative command that just tells
> you the name of the current database?
>
> Everytime I forget if I am in the right database, I do a 'use foo'
> thing, and it reports 'Database changed' always, even if I am in the
> same database, which I find somewhat irritating and also ignorant on
> my part.
>
> How do I know which database I am sitting inside. I tried looking up
> the manual but couldn't find something like CUR_DB or CURRENT_DB or
> some such thing.





Sorry, feeling stupid about my question. Soon after I hit the 'Send'
button on the original post, I came accross the DATABASE() function in
the manual.

*RESOLVED*

  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 01h24.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,07314 seconds with 10 queries