Class: AzureSQLConnector
Defined in: src/connectors/azure-sql.ts:47
Secure Azure SQL Database connector
SSL is always enforced (Azure requirement).
Features:
- SQL injection prevention
- Connection timeouts
- SSL always enforced (Azure requirement)
- Azure AD token-based authentication support
- Read-only query patterns
- Secure error handling
Example
import { AzureSQLConnector } from '@freshguard/freshguard-core';
const connector = new AzureSQLConnector({
host: 'myserver.database.windows.net', port: 1433,
database: 'analytics',
username: 'readonly',
password: process.env.AZURE_SQL_PASSWORD!,
});
Extends
BaseConnector
Constructors
Constructor
new AzureSQLConnector(
config,securityConfig?):AzureSQLConnector
Defined in: src/connectors/azure-sql.ts:57
Parameters
config
ConnectorConfig
Database connection settings (host, port, database, credentials).
Pass options.schema to target a specific schema (default: 'dbo').
securityConfig?
Partial<SecurityConfig>
Optional overrides for query timeouts, max rows, and blocked keywords
Returns
AzureSQLConnector
Overrides
BaseConnector.constructor
Properties
config
protectedconfig:ConnectorConfig
Defined in: src/connectors/base-connector.ts:63
Inherited from
BaseConnector.config
connectionTimeout
protectedreadonlyconnectionTimeout:number
Defined in: src/connectors/base-connector.ts:49
Inherited from
BaseConnector.connectionTimeout
enableDetailedLogging
protectedreadonlyenableDetailedLogging:boolean
Defined in: src/connectors/base-connector.ts:57
Inherited from
BaseConnector.enableDetailedLogging
enableQueryAnalysis
protectedreadonlyenableQueryAnalysis:boolean
Defined in: src/connectors/base-connector.ts:58
Inherited from
BaseConnector.enableQueryAnalysis
logger
protectedreadonlylogger:StructuredLogger
Defined in: src/connectors/base-connector.ts:53
Inherited from
BaseConnector.logger
maxRows
protectedreadonlymaxRows:number
Defined in: src/connectors/base-connector.ts:51
Inherited from
BaseConnector.maxRows
metrics
protectedreadonlymetrics:MetricsCollector
Defined in: src/connectors/base-connector.ts:54
Inherited from
BaseConnector.metrics
queryAnalyzer
protectedreadonlyqueryAnalyzer:QueryComplexityAnalyzer
Defined in: src/connectors/base-connector.ts:55
Inherited from
BaseConnector.queryAnalyzer
queryTimeout
protectedreadonlyqueryTimeout:number
Defined in: src/connectors/base-connector.ts:50
Inherited from
BaseConnector.queryTimeout
requireSSL
protectedreadonlyrequireSSL:boolean
Defined in: src/connectors/base-connector.ts:52
Inherited from
BaseConnector.requireSSL
schemaCache
protectedreadonlyschemaCache:SchemaCache
Defined in: src/connectors/base-connector.ts:56
Inherited from
BaseConnector.schemaCache
Methods
cleanup()
protectedcleanup():void
Defined in: src/connectors/base-connector.ts:806
Cleanup resources (should be called by subclasses in their close method)
Returns
void
Inherited from
BaseConnector.cleanup
clearSchemaCache()
protectedclearSchemaCache():void
Defined in: src/connectors/base-connector.ts:792
Clear schema cache for testing or maintenance
Returns
void
Inherited from
BaseConnector.clearSchemaCache
close()
close():
Promise<void>
Defined in: src/connectors/azure-sql.ts:421
Close the database connection
Returns
Promise<void>
Overrides
BaseConnector.close
connectLegacy()
connectLegacy(
credentials):Promise<void>
Defined in: src/connectors/azure-sql.ts:515
Legacy connect method for backward compatibility
Parameters
credentials
Returns
Promise<void>
Deprecated
Use constructor with ConnectorConfig instead
createDebugErrorFactory()
protectedcreateDebugErrorFactory(debugConfig?):DebugErrorFactory
Defined in: src/connectors/base-connector.ts:843
Helper method for subclasses to create debug-enabled error factory
Parameters
debugConfig?
DebugConfig
Returns
DebugErrorFactory
Inherited from
BaseConnector.createDebugErrorFactory
escapeIdentifier()
protectedescapeIdentifier(identifier):string
Defined in: src/connectors/azure-sql.ts:492
Override escapeIdentifier for SQL Server bracket notation
Parameters
identifier
string
Returns
string