UNPKG

nodejs-jdbc

Version:
772 lines 26.8 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DatabaseMetaData = void 0; const ResultSet_1 = require("./ResultSet"); const Connection_1 = require("./Connection"); const jinst_1 = require("./jinst"); const java = (0, jinst_1.getInstance)(); class DatabaseMetaData { constructor(databaseMetaData) { this.dbm = databaseMetaData; } async getSchemas(catalog, schemaPattern) { return new Promise((resolve, reject) => { if (catalog) { this.dbm .getSchemasPromise(catalog, schemaPattern) .then((result) => { return resolve(new ResultSet_1.ResultSet(result)); }) .catch((error) => { return reject(error); }); } this.dbm .getSchemasPromise() .then((result) => { return resolve(new ResultSet_1.ResultSet(result)); }) .catch((error) => { return reject(error); }); }); } async getTables(catalog, schemaPattern, tableNamePattern, types) { return new Promise((resolve, reject) => { this.dbm .getTablesPromise(catalog, schemaPattern, tableNamePattern, types) .then((result) => { return resolve(new ResultSet_1.ResultSet(result)); }) .catch((error) => { return reject(error); }); }); } allProceduresAreCallable() { return this.dbm.allProceduresAreCallableSync(); } allTablesAreSelectable() { return this.dbm.allTablesAreSelectableSync(); } autoCommitFailureClosesAllResultSets() { return this.dbm.autoCommitFailureClosesAllResultSetsSync(); } dataDefinitionCausesTransactionCommit() { return this.dbm.dataDefinitionCausesTransactionCommitSync(); } dataDefinitionIgnoredInTransactions() { return this.dbm.dataDefinitionIgnoredInTransactionsSync(); } deletesAreDetected(type) { return this.dbm.deletesAreDetectedSync(type); } doesMaxRowSizeIncludeBlobs() { return this.dbm.doesMaxRowSizeIncludeBlobsSync(); } generatedKeyAlwaysReturned() { return this.dbm.generatedKeyAlwaysReturnedSync(); } async getAttributes(catalog, schemaPattern, typeNamePattern, attributeNamePattern) { return new Promise((resolve, reject) => { this.dbm .getAttributesPromise(catalog, schemaPattern, typeNamePattern, attributeNamePattern) .then((result) => { return resolve(new ResultSet_1.ResultSet(result)); }) .catch((error) => { return reject(error); }); }); } async getBestRowIdentifier(catalog, schema, table, scope, nullable) { return new Promise((resolve, reject) => { this.dbm .getBestRowIdentifierPromise(catalog, schema, table, scope, nullable) .then((result) => { return resolve(new ResultSet_1.ResultSet(result)); }) .catch((error) => { return reject(error); }); }); } async getCatalogs() { return new Promise((resolve, reject) => { this.dbm .getCatalogsPromise() .then((result) => { return resolve(new ResultSet_1.ResultSet(result)); }) .catch((error) => { return reject(error); }); }); } getCatalogSeparator() { return this.dbm.getCatalogSeparatorSync(); } getCatalogTerm() { return this.dbm.getCatalogTermSync(); } async getClientInfoProperties() { return new Promise((resolve, reject) => { this.dbm .getClientInfoPropertiesPromise() .then((result) => resolve(new ResultSet_1.ResultSet(result))) .catch((error) => reject(error)); }); } async getColumnPrivileges(catalog, schema, table, columnNamePattern) { return new Promise((resolve, reject) => { this.dbm .getColumnPrivilegesPromise(catalog, schema, table, columnNamePattern) .then((result) => resolve(new ResultSet_1.ResultSet(result))) .catch((error) => reject(error)); }); } async getColumns(catalog, schemaPattern, tableNamePattern, columnNamePattern) { return new Promise((resolve, reject) => { this.dbm .getColumnsPromise(catalog, schemaPattern, tableNamePattern, columnNamePattern) .then((result) => { resolve(new ResultSet_1.ResultSet(result)); }) .catch((error) => { reject(error); }); }); } getConnection() { return new Promise((resolve, reject) => { this.dbm .getConnectionPromise() .then((result) => { resolve(new Connection_1.Connection(result)); }) .catch((error) => { reject(error); }); }); } async getCrossReference(parentCatalog, parentSchema, parentTable, foreignCatalog, foreignSchema, foreignTable) { return new Promise((resolve, reject) => { this.dbm .getCrossReferencePromise(parentCatalog, parentSchema, parentTable, foreignCatalog, foreignSchema, foreignTable) .then((result) => resolve(new ResultSet_1.ResultSet(result))) .catch((error) => reject(error)); }); } getDatabaseMajorVersion() { return this.dbm.getDatabaseMajorVersionSync(); } getDatabaseMinorVersion() { return this.dbm.getDatabaseMinorVersionSync(); } getDatabaseProductName() { return this.dbm.getDatabaseProductNameSync(); } getDatabaseProductVersion() { return this.dbm.getDatabaseProductVersionSync(); } getDefaultTransactionIsolation() { return this.dbm.getDefaultTransactionIsolationSync(); } getDriverMajorVersion() { return this.dbm.getDriverMajorVersionSync(); } getDriverMinorVersion() { return this.dbm.getDriverMinorVersionSync(); } getDriverName() { return this.dbm.getDriverNameSync(); } getDriverVersion() { return this.dbm.getDriverVersionSync(); } async getExportedKeys(catalog, schema, table) { return new Promise((resolve, reject) => { this.dbm .getExportedKeysPromise(catalog, schema, table) .then((result) => { resolve(new ResultSet_1.ResultSet(result)); }) .catch((error) => reject(error)); }); } getExtraNameCharacters() { return this.dbm.getExtraNameCharactersSync(); } async getFunctionColumns(catalog, schemaPattern, functionNamePattern, columnNamePattern) { return new Promise((resolve, reject) => { this.dbm .getFunctionColumnsPromise(catalog, schemaPattern, functionNamePattern, columnNamePattern) .then((result) => resolve(new ResultSet_1.ResultSet(result))) .catch((error) => reject(error)); }); } async getFunctions(catalog, schemaPattern, functionNamePattern) { return new Promise((resolve, reject) => { this.dbm .getFunctionsPromise(catalog, schemaPattern, functionNamePattern) .then((result) => resolve(new ResultSet_1.ResultSet(result))) .catch((error) => reject(error)); }); } getIdentifierQuoteString() { return this.dbm.getIdentifierQuoteStringSync(); } async getImportedKeys(catalog, schema, table) { return new Promise((resolve, reject) => { this.dbm .getImportedKeysPromise(catalog, schema, table) .then((result) => resolve(new ResultSet_1.ResultSet(result))) .catch((error) => reject(error)); }); } async getIndexInfo(catalog, schema, table, unique, approximate) { return new Promise((resolve, reject) => { this.dbm .getIndexInfoPromise(catalog, schema, table, unique, approximate) .then((result) => resolve(new ResultSet_1.ResultSet(result))) .catch((error) => reject(error)); }); } getJDBCMajorVersion() { return this.dbm.getJDBCMajorVersionSync(); } getJDBCMinorVersion() { return this.dbm.getJDBCMinorVersionSync(); } getMaxBinaryLiteralLength() { return this.dbm.getMaxBinaryLiteralLengthSync(); } getMaxCatalogNameLength() { return this.dbm.getMaxCatalogNameLengthSync(); } getMaxCharLiteralLength() { return this.dbm.getMaxCharLiteralLengthSync(); } getMaxColumnNameLength() { return this.dbm.getMaxColumnNameLengthSync(); } getMaxColumnsInGroupBy() { return this.dbm.getMaxColumnsInGroupBySync(); } getMaxColumnsInIndex() { return this.dbm.getMaxColumnsInIndexSync(); } getMaxColumnsInOrderBy() { return this.dbm.getMaxColumnsInOrderBySync(); } getMaxColumnsInSelect() { return this.dbm.getMaxColumnsInSelectSync(); } getMaxColumnsInTable() { return this.dbm.getMaxColumnsInTableSync(); } getMaxConnections() { return this.dbm.getMaxConnectionsSync(); } getMaxCursorNameLength() { return this.dbm.getMaxCursorNameLengthSync(); } getMaxIndexLength() { return this.dbm.getMaxIndexLengthSync(); } getMaxProcedureNameLength() { return this.dbm.getMaxProcedureNameLengthSync(); } getMaxRowSize() { return this.dbm.getMaxRowSizeSync(); } getMaxSchemaNameLength() { return this.dbm.getMaxSchemaNameLengthSync(); } getMaxStatementLength() { return this.dbm.getMaxStatementLengthSync(); } getMaxStatements() { return this.dbm.getMaxStatementsSync(); } getMaxTableNameLength() { return this.dbm.getMaxTableNameLengthSync(); } getMaxTablesInSelect() { return this.dbm.getMaxTablesInSelectSync(); } getMaxUserNameLength() { return this.dbm.getMaxUserNameLengthSync(); } getNumericFunctions() { return this.dbm.getNumericFunctionsSync(); } async getPrimaryKeys(catalog, schema, table) { return new Promise((resolve, reject) => { this.dbm .getPrimaryKeysPromise(catalog, schema, table) .then((result) => resolve(new ResultSet_1.ResultSet(result))) .catch((err) => reject(err)); }); } async getProcedureColumns(catalog, schemaPattern, procedureNamePattern, columnNamePattern) { return new Promise((resolve, reject) => { this.dbm .getProcedureColumnsPromise(catalog, schemaPattern, procedureNamePattern, columnNamePattern) .then((result) => resolve(new ResultSet_1.ResultSet(result))) .catch((err) => reject(err)); }); } getProcedures(catalog, schemaPattern, procedureNamePattern) { return new Promise((resolve, reject) => { this.dbm .getProceduresPromise(catalog, schemaPattern, procedureNamePattern) .then((result) => resolve(new ResultSet_1.ResultSet(result))) .catch((err) => reject(err)); }); } getProcedureTerm() { return this.dbm.getProcedureTermSync(); } getPseudoColumns(catalog, schemaPattern, tableNamePattern, columnNamePattern) { return new Promise((resolve, reject) => { this.dbm .getPseudoColumnsPromise(catalog, schemaPattern, tableNamePattern, columnNamePattern) .then((result) => resolve(new ResultSet_1.ResultSet(result))) .catch((err) => reject(err)); }); } getResultSetHoldability() { return this.dbm.getResultSetHoldabilitySync(); } getRowIdLifetime() { return this.dbm.getRowIdLifetimeSync(); } getSchemaTerm() { return this.dbm.getSchemaTermSync(); } getSearchStringEscape() { return this.dbm.getSearchStringEscapeSync(); } getSQLKeywords() { return this.dbm.getSQLKeywordsSync(); } getSQLStateType() { return this.dbm.getSQLStateTypeSync(); } getStringFunctions() { return this.dbm.getStringFunctionsSync(); } async getSuperTables(catalog, schemaPattern, tableNamePattern) { return new Promise((resolve, reject) => { this.dbm .getSuperTablesPromise(catalog, schemaPattern, tableNamePattern) .then((result) => resolve(new ResultSet_1.ResultSet(result))) .catch((err) => reject(err)); }); } async getSuperTypes(catalog, schemaPattern, typeNamePattern) { return new Promise((resolve, reject) => { this.dbm .getSuperTypesPromise(catalog, schemaPattern, typeNamePattern) .then((result) => resolve(new ResultSet_1.ResultSet(result))) .catch((err) => reject(err)); }); } getSystemFunctions() { return this.dbm.getSystemFunctionsSync(); } async getTablePrivileges(catalog, schemaPattern, tableNamePattern) { return new Promise((resolve, reject) => { this.dbm .getTablePrivilegesPromise(catalog, schemaPattern, tableNamePattern) .then((result) => resolve(new ResultSet_1.ResultSet(result))) .catch((err) => reject(err)); }); } async getTableTypes() { return new Promise((resolve, reject) => { this.dbm .getTableTypesPromise() .then((result) => resolve(new ResultSet_1.ResultSet(result))) .catch((err) => reject(err)); }); } getTimeDateFunctions() { return this.dbm.getTimeDateFunctionsSync(); } getTypeInfo() { return new Promise((resolve, reject) => { this.dbm .getTypeInfoPromise() .then((result) => { resolve(new ResultSet_1.ResultSet(result)); }) .catch((err) => reject(err)); }); } getUDTs(catalog, schemaPattern, typeNamePattern, types) { return new Promise((resolve, reject) => { this.dbm .getUDTsPromise(catalog, schemaPattern, typeNamePattern, types) .then((result) => resolve(new ResultSet_1.ResultSet(result))) .catch((err) => reject(err)); }); } getURL() { return this.dbm.getURLSync(); } getUserName() { return this.dbm.getUserNameSync(); } getVersionColumns(catalog, schema, table) { return new Promise((resolve, reject) => { this.dbm .getVersionColumnsPromise(catalog, schema, table) .then((result) => { resolve(new ResultSet_1.ResultSet(result)); }) .catch((err) => reject(err)); }); } insertsAreDetected(type) { return this.dbm.insertsAreDetectedSync(type); } isCatalogAtStart() { return this.dbm.isCatalogAtStartSync(); } isReadOnly() { return this.dbm.isReadOnlySync(); } locatorsUpdateCopy() { return this.dbm.locatorsUpdateCopySync(); } nullPlusNonNullIsNull() { return this.dbm.nullPlusNonNullIsNullSync(); } nullsAreSortedAtEnd() { return this.dbm.nullsAreSortedAtEndSync(); } nullsAreSortedAtStart() { return this.dbm.nullsAreSortedAtStartSync(); } nullsAreSortedHigh() { return this.dbm.nullsAreSortedHighSync(); } nullsAreSortedLow() { return this.dbm.nullsAreSortedLowSync(); } othersDeletesAreVisible(type) { return this.dbm.othersDeletesAreVisibleSync(type); } othersInsertsAreVisible(type) { return this.dbm.othersInsertsAreVisibleSync(type); } othersUpdatesAreVisible(type) { return this.dbm.othersUpdatesAreVisibleSync(type); } ownDeletesAreVisible(type) { return this.dbm.ownDeletesAreVisibleSync(type); } ownInsertsAreVisible(type) { return this.dbm.ownInsertsAreVisibleSync(type); } ownUpdatesAreVisible(type) { return this.dbm.ownUpdatesAreVisibleSync(type); } storesLowerCaseIdentifiers() { return this.dbm.storesLowerCaseIdentifiersSync(); } storesLowerCaseQuotedIdentifiers() { return this.dbm.storesLowerCaseQuotedIdentifiersSync(); } storesMixedCaseIdentifiers() { return this.dbm.storesMixedCaseIdentifiersSync(); } storesMixedCaseQuotedIdentifiers() { return this.dbm.storesMixedCaseQuotedIdentifiersSync(); } storesUpperCaseIdentifiers() { return this.dbm.storesUpperCaseIdentifiersSync(); } storesUpperCaseQuotedIdentifiers() { return this.dbm.storesUpperCaseQuotedIdentifiersSync(); } supportsAlterTableWithAddColumn() { return this.dbm.supportsAlterTableWithAddColumnSync(); } supportsAlterTableWithDropColumn() { return this.dbm.supportsAlterTableWithDropColumnSync(); } supportsANSI92EntryLevelSQL() { return this.dbm.supportsANSI92EntryLevelSQLSync(); } supportsANSI92FullSQL() { return this.dbm.supportsANSI92FullSQLSync(); } supportsANSI92IntermediateSQL() { return this.dbm.supportsANSI92IntermediateSQLSync(); } supportsBatchUpdates() { return this.dbm.supportsBatchUpdatesSync(); } supportsCatalogsInDataManipulation() { return this.dbm.supportsCatalogsInDataManipulationSync(); } supportsCatalogsInIndexDefinitions() { return this.dbm.supportsCatalogsInIndexDefinitionsSync(); } supportsCatalogsInPrivilegeDefinitions() { return this.dbm.supportsCatalogsInPrivilegeDefinitionsSync(); } supportsCatalogsInProcedureCalls() { return this.dbm.supportsCatalogsInProcedureCallsSync(); } supportsCatalogsInTableDefinitions() { return this.dbm.supportsCatalogsInTableDefinitionsSync(); } supportsColumnAliasing() { return this.dbm.supportsColumnAliasingSync(); } supportsConvert(fromType, toType) { return this.dbm.supportsConvertSync(fromType, toType); } supportsCoreSQLGrammar() { return this.dbm.supportsCoreSQLGrammarSync(); } supportsCorrelatedSubqueries() { return this.dbm.supportsCorrelatedSubqueriesSync(); } supportsDataDefinitionAndDataManipulationTransactions() { return this.dbm.supportsDataDefinitionAndDataManipulationTransactionsSync(); } supportsDataManipulationTransactionsOnly() { return this.dbm.supportsDataManipulationTransactionsOnlySync(); } supportsDifferentTableCorrelationNames() { return this.dbm.supportsDifferentTableCorrelationNamesSync(); } supportsExpressionsInOrderBy() { return this.dbm.supportsExpressionsInOrderBySync(); } supportsExtendedSQLGrammar() { return this.dbm.supportsExtendedSQLGrammarSync(); } supportsFullOuterJoins() { return this.dbm.supportsFullOuterJoinsSync(); } supportsGetGeneratedKeys() { return this.dbm.supportsGetGeneratedKeysSync(); } supportsGroupBy() { return this.dbm.supportsGroupBySync(); } supportsGroupByBeyondSelect() { return this.dbm.supportsGroupByBeyondSelectSync(); } supportsGroupByUnrelated() { return this.dbm.supportsGroupByUnrelatedSync(); } supportsIntegrityEnhancementFacility() { return this.dbm.supportsIntegrityEnhancementFacilitySync(); } supportsLikeEscapeClause() { return this.dbm.supportsLikeEscapeClauseSync(); } supportsLimitedOuterJoins() { return this.dbm.supportsLimitedOuterJoinsSync(); } supportsMinimumSQLGrammar() { return this.dbm.supportsMinimumSQLGrammarSync(); } supportsMixedCaseIdentifiers() { return this.dbm.supportsMixedCaseIdentifiersSync(); } supportsMixedCaseQuotedIdentifiers() { return this.dbm.supportsMixedCaseQuotedIdentifiersSync(); } supportsMultipleOpenResults() { return this.dbm.supportsMultipleOpenResultsSync(); } supportsMultipleResultSets() { return this.dbm.supportsMultipleResultSetsSync(); } supportsMultipleTransactions() { return this.dbm.supportsMultipleTransactionsSync(); } supportsNamedParameters() { return this.dbm.supportsNamedParametersSync(); } supportsNonNullableColumns() { return this.dbm.supportsNonNullableColumnsSync(); } supportsOpenCursorsAcrossCommit() { return this.dbm.supportsOpenCursorsAcrossCommitSync(); } supportsOpenCursorsAcrossRollback() { return this.dbm.supportsOpenCursorsAcrossRollbackSync(); } supportsOpenStatementsAcrossCommit() { return this.dbm.supportsOpenStatementsAcrossCommitSync(); } supportsOpenStatementsAcrossRollback() { return this.dbm.supportsOpenStatementsAcrossRollbackSync(); } supportsOrderByUnrelated() { return this.dbm.supportsOrderByUnrelatedSync(); } supportsOuterJoins() { return this.dbm.supportsOuterJoinsSync(); } supportsPositionedDelete() { return this.dbm.supportsPositionedDeleteSync(); } supportsPositionedUpdate() { this.dbm.supportsPositionedUpdateSync(); } supportsResultSetConcurrency(type, concurrency) { return this.dbm.supportsResultSetConcurrencySync(type, concurrency); } supportsResultSetHoldability(holdability) { return this.dbm.supportsResultSetHoldabilitySync(holdability); } supportsResultSetType(type) { return this.dbm.supportsResultSetTypeSync(type); } supportsSavepoints() { return this.dbm.supportsSavepointsSync(); } supportsSchemasInDataManipulation() { return this.dbm.supportsSchemasInDataManipulationSync(); } supportsSchemasInIndexDefinitions() { return this.dbm.supportsSchemasInIndexDefinitionsSync(); } supportsSchemasInPrivilegeDefinitions() { return this.dbm.supportsSchemasInPrivilegeDefinitionsSync(); } supportsSchemasInProcedureCalls() { return this.dbm.supportsSchemasInProcedureCallsSync(); } supportsSchemasInTableDefinitions() { return this.dbm.supportsSchemasInTableDefinitionsSync(); } supportsSelectForUpdate() { return this.dbm.supportsSelectForUpdateSync(); } supportsStatementPooling() { return this.dbm.supportsStatementPoolingSync(); } supportsStoredFunctionsUsingCallSyntax() { return this.dbm.supportsStoredFunctionsUsingCallSyntaxSync(); } supportsStoredProcedures() { return this.dbm.supportsStoredProceduresSync(); } supportsSubqueriesInComparisons() { return this.dbm.supportsSubqueriesInComparisonsSync(); } supportsSubqueriesInExists() { return this.dbm.supportsSubqueriesInExistsSync(); } supportsSubqueriesInIns() { return this.dbm.supportsSubqueriesInInsSync(); } supportsSubqueriesInQuantifieds() { return this.dbm.supportsSubqueriesInQuantifiedsSync(); } supportsTableCorrelationNames() { return this.dbm.supportsTableCorrelationNamesSync(); } supportsTransactionIsolationLevel(level) { return this.dbm.supportsTransactionIsolationLevelSync(level); } supportsTransactions() { return this.dbm.supportsTransactionsSync(); } supportsUnion() { return this.dbm.supportsUnionSync(); } supportsUnionAll() { return this.dbm.supportsUnionAllSync(); } updatesAreDetected(type) { return this.dbm.updatesAreDetectedSync(type); } usesLocalFilePerTable() { return this.dbm.usesLocalFilePerTableSync(); } usesLocalFiles() { return this.dbm.usesLocalFilesSync(); } } exports.DatabaseMetaData = DatabaseMetaData; jinst_1.events.once('initialized', () => { const staticAttrs = [ 'attributeNoNulls', 'attributeNullable', 'attributeNullableUnknown', 'bestRowNotPseudo', 'bestRowPseudo', 'bestRowSession', 'bestRowTemporary', 'bestRowTransaction', 'bestRowUnknown', 'columnNoNulls', 'columnNullable', 'columnNullableUnknown', 'functionColumnIn', 'functionColumnInOut', 'functionColumnOut', 'functionColumnResult', 'functionColumnUnknown', 'functionNoNulls', 'functionNoTable', 'functionNullable', 'functionNullableUnknown', 'functionResultUnknown', 'functionReturn', 'functionReturnsTable', 'importedKeyCascade', 'importedKeyInitiallyDeferred', 'importedKeyInitiallyImmediate', 'importedKeyNoAction', 'importedKeyNotDeferrable', 'importedKeyRestrict', 'importedKeySetDefault', 'importedKeySetNull', 'procedureColumnIn', 'procedureColumnInOut', 'procedureColumnOut', 'procedureColumnResult', 'procedureColumnReturn', 'procedureColumnUnknown', 'procedureNoNulls', 'procedureNoResult', 'procedureNullable', 'procedureNullableUnknown', 'procedureResultUnknown', 'procedureReturnsResult', 'sqlStateSQL', 'sqlStateSQL99', 'sqlStateXOpen', 'tableIndexClustered', 'tableIndexHashed', 'tableIndexOther', 'tableIndexStatistic', 'typeNoNulls', 'typeNullable', 'typeNullableUnknown', 'typePredBasic', 'typePredChar', 'typePredNone', 'typeSearchable', 'versionColumnNotPseudo', 'versionColumnPseudo', 'versionColumnUnknown', ]; staticAttrs.forEach((attr) => { DatabaseMetaData[attr] = java.getStaticFieldValue('java.sql.DatabaseMetaData', attr); }); }); //# sourceMappingURL=DatabaseMetadata.js.map