User Tools

Site Tools




22.4.5 Class DatabaseUser (gb.db)

This class represents a user of a database for PostgreSQL and MySQL.

SQLite has no user concept. Access to an SQLite database is controlled by the actual file permissions of the database file. This means that the login is always the user ID that executes the Gambas programme. Properties

The DatabaseUser class has four properties:

PropertyData typeDescription
AdministratorBooleanReturns whether a user is a database administrator or not. The property can only be read.
ConnectionConnectionReturns the parent DB connection object of the user. The property can only be read.
NameStringReturns the name of the user. The property can only be read.
PasswordStringSets the password of the specified DB user or reads it in encrypted form.

Table : Properties of the DatabaseUser class Methods

The DatabaseUser class only has the Sub Delete ( ) method. It deletes the specified DB user.


You can use the following source code to read information about the users of PostgreSQL and MySQL databases:

  Dim hDataBase As Database
  Dim hDBUser As DatabaseUser
  For Each hDataBase In DBCS.DBConnection.Databases
    If DBCS.DBConnection.Type Begins "sqlite" Then
       Print "The database `"; hDataBase.Name; "` is an SQLite database."
       Print "The information on the DB user (DBUserName, DBUserPassword) therefore does not exist!"
       Print "If the DBUser is a DBAdministrator: "; IIf(hDBUser.Administrator = True, "yes", "no")
       Print "DBUser: "; hDBUser.Name
       Print "DBConnection: "; hDBUser.Connection
       Print "DBPassword: "; IIf(hDBUser.Password, "hDBUser.Password", "Do not set a password.")
       Print "................................"

This is the output in the console of the Gambas IDE for a database connection to exactly one SQLite3 database:

The database `contacts.sqlite` is an SQLite database.
The DB user details (DBUserName, DBUserPassword) therefore do not exist!
The website uses a temporary session cookie. This technically necessary cookie is deleted when the browser is closed. You can find information on cookies in our privacy policy.
k22/k22.4/k22.4.5/start.txt · Last modified: 27.04.2024 by emma

Page Tools