Class Database
java.lang.Object
com.storedobject.core.Database
com.storedobject.database.postgres.Database
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
alterPassword
(String user, String oldPassword, String newPassword) Change password of the user on the SQL connection.Get the SQL statement string to call the stored procedure.columnType
(String columnType, int width, int precision) boolean
createLogin
(String user, String password) Creates a login with the given login name and password.protected String[]
createSchemaDDL
(String schemaName) The SQL column that can bring the current time from the database.databaseSQL
(String databaseName) Part of the SQL string (starting with FROM) that can query details of a database.protected String
dropDatabaseDDL
(String databaseName) boolean
Drops a login with the given login name and password.Get the name of Object class of this database.getSerial
(int tag) Get the SQL statement for generating next Id for the tag passed.boolean
Check if the username passed is a valid login of the sql connection passed.boolean
Checks if the username and password are correct in the current database.The name of the model database.name()
The name of the driver.parentTable
(String tableName) protected boolean
resetPassword
(String user, String securityPassword, String newPassword) Reset the password of the user, given the security password.userSQL()
The SQL string that can return the login name of the current user as a column value.Methods inherited from class com.storedobject.core.Database
changePassword, columnDetails, createDatabase, createDatabaseDDL, createSchema, createTable, currentTimeSQL, databaseExists, dependentConstraints, dropDatabase, ensureMaster, executeSQL, executeSQL, executeSQL, executeSQL, executeSQL, foreignKeyConstraintNames, foreignKeyConstraints, format, formatWithTime, get, getCurrentTime, getSQL, initialPassword, isMaster, lockDatabase, login, maxTime, maxTimeStamp, nanoDigits, schemaExists, securityLogin, tableExists, validateSecurityPassword, viewExists
-
Constructor Details
-
Database
public Database()
-
-
Method Details
-
name
-
modelDatabase
Description copied from class:Database
The name of the model database. Such a concept is there in some database systems.- Specified by:
modelDatabase
in classDatabase
- Returns:
- The name of the model database. Null string may be returned if such a concept does not exist.
-
userSQL
-
databaseSQL
Description copied from class:Database
Part of the SQL string (starting with FROM) that can query details of a database.- Specified by:
databaseSQL
in classDatabase
- Parameters:
databaseName
- Database name.- Returns:
- Part of the SQL string.
-
isALogin
Description copied from class:Database
Check if the username passed is a valid login of the sql connection passed. -
isALogin
Description copied from class:Database
Checks if the username and password are correct in the current database. -
createLogin
Description copied from class:Database
Creates a login with the given login name and password.- Specified by:
createLogin
in classDatabase
- Parameters:
user
- The login name.password
- The security password.- Returns:
- True if successfully created.
-
dropLogin
-
alterPassword
Description copied from class:Database
Change password of the user on the SQL connection.- Specified by:
alterPassword
in classDatabase
- Parameters:
user
- The login name whose password needs to be changed.oldPassword
- Old password.newPassword
- New password.- Returns:
- True if the password is successfully changed.
-
resetPassword
Description copied from class:Database
Reset the password of the user, given the security password.- Specified by:
resetPassword
in classDatabase
- Parameters:
user
- The login name whose password needs to be changed.securityPassword
- The security superuser's passwordnewPassword
- The password for the user.- Returns:
- True if the password is successfully changed.
-
currentTime
Description copied from class:Database
The SQL column that can bring the current time from the database. For example, in the case of Sybase Adaptive Server Enterprise, it will return "getdate()".- Specified by:
currentTime
in classDatabase
- Returns:
- The SQL column that can bring the current time from the database.
-
getSerial
-
callProc
Description copied from class:Database
Get the SQL statement string to call the stored procedure. For example, in the case of Sybase Adaptive Server Enterprise, if a procedure called "AuthorizeTran" needs to be invoked with parameters "25, 345, 23", this method will return "EXEC AuthorizeTran 25, 345, 23". -
columnType
- Specified by:
columnType
in classDatabase
-
dropDatabaseDDL
- Specified by:
dropDatabaseDDL
in classDatabase
-
createSchemaDDL
- Specified by:
createSchemaDDL
in classDatabase
-
getObjectClassName
Description copied from class:Database
Get the name of Object class of this database.- Specified by:
getObjectClassName
in classDatabase
- Returns:
- Full name of the class
-
parentTable
- Specified by:
parentTable
in classDatabase
-