@saptools/cf-hana 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/README.md +66 -12
- package/dist/cli.js +422 -107
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +32 -1
- package/dist/index.js +418 -105
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -96,6 +96,32 @@ interface HanaClientInfo {
|
|
|
96
96
|
readonly credentialSource: CredentialSource;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
+
type WriteBackupOperation = "update" | "delete";
|
|
100
|
+
interface WriteBackupPlan {
|
|
101
|
+
readonly operation: WriteBackupOperation;
|
|
102
|
+
readonly statementSql: string;
|
|
103
|
+
readonly selectSql: string;
|
|
104
|
+
readonly selectParams: readonly SqlParam[];
|
|
105
|
+
}
|
|
106
|
+
interface SqlBackupWriteInput {
|
|
107
|
+
readonly operation: WriteBackupOperation;
|
|
108
|
+
readonly statementSql: string;
|
|
109
|
+
readonly result: QueryResult;
|
|
110
|
+
}
|
|
111
|
+
interface SqlBackupWriteOptions {
|
|
112
|
+
readonly now?: Date;
|
|
113
|
+
readonly saptoolsRoot?: string;
|
|
114
|
+
}
|
|
115
|
+
interface SqlBackupRecord {
|
|
116
|
+
readonly directory: string;
|
|
117
|
+
readonly statementPath: string;
|
|
118
|
+
readonly backupPath: string;
|
|
119
|
+
readonly rowCount: number;
|
|
120
|
+
}
|
|
121
|
+
declare function cfHanaBackupRoot(saptoolsRoot?: string): string;
|
|
122
|
+
declare function buildWriteBackupPlan(sql: string, params?: readonly SqlParam[]): WriteBackupPlan | undefined;
|
|
123
|
+
declare function writeSqlBackup(input: SqlBackupWriteInput, options?: SqlBackupWriteOptions): Promise<SqlBackupRecord>;
|
|
124
|
+
|
|
99
125
|
interface DriverExecResult {
|
|
100
126
|
readonly rows: readonly Record<string, SqlParam>[];
|
|
101
127
|
readonly columns: readonly QueryResultColumn[];
|
|
@@ -219,6 +245,8 @@ declare class HanaClient {
|
|
|
219
245
|
query<TRow = QueryRow>(sql: string, params?: readonly SqlParam[], options?: QueryOptions): Promise<QueryResult<TRow>>;
|
|
220
246
|
/** Run a DML/DDL statement and return its affected-row count. */
|
|
221
247
|
execute(sql: string, params?: readonly SqlParam[], options?: QueryOptions): Promise<QueryResult>;
|
|
248
|
+
/** Back up rows matched by an UPDATE or DELETE before the caller runs it. */
|
|
249
|
+
backupWriteStatement(sql: string, params?: readonly SqlParam[], options?: QueryOptions): Promise<SqlBackupRecord | undefined>;
|
|
222
250
|
/** Run a typed `SELECT` built from a spec. */
|
|
223
251
|
selectFrom<TRow = QueryRow>(spec: SelectSpec): Promise<QueryResult<TRow>>;
|
|
224
252
|
/** Count rows in a table, optionally filtered. */
|
|
@@ -241,6 +269,9 @@ declare class HanaClient {
|
|
|
241
269
|
explain(sql: string, params?: readonly SqlParam[]): Promise<QueryResult>;
|
|
242
270
|
/** Close every pooled connection. The client must not be used afterwards. */
|
|
243
271
|
close(): Promise<void>;
|
|
272
|
+
private runQuery;
|
|
273
|
+
private runExecute;
|
|
274
|
+
private recordSqlHistory;
|
|
244
275
|
}
|
|
245
276
|
|
|
246
277
|
/**
|
|
@@ -313,4 +344,4 @@ declare class DestructiveStatementError extends CfHanaError {
|
|
|
313
344
|
/** Narrow an unknown thrown value to a human-readable message. */
|
|
314
345
|
declare function errorMessage(error: unknown): string;
|
|
315
346
|
|
|
316
|
-
export { type BuiltStatement, CfHanaError, type CfHanaErrorCode, type ColumnInfo, type ConnectOptions, type CredentialSource, CredentialsNotFoundError, type DbUserRole, DestructiveStatementError, type DriverConnectParams, type DriverConnection, type DriverExecResult, HanaClient, type HanaClientInfo, type HanaDriver, type OutputFormat, type PoolOptions, QueryError, type QueryOptions, type QueryResult, type QueryResultColumn, type QueryRow, ReadOnlyViolationError, type SelectSpec, type SqlParam, type StatementKind, type TableInfo, Transaction, buildCount, buildDelete, buildInsert, buildSelect, buildUpdate, connect, createDriver, errorMessage, formatCsv, formatJson, formatResult, formatTable, query, withConnection };
|
|
347
|
+
export { type BuiltStatement, CfHanaError, type CfHanaErrorCode, type ColumnInfo, type ConnectOptions, type CredentialSource, CredentialsNotFoundError, type DbUserRole, DestructiveStatementError, type DriverConnectParams, type DriverConnection, type DriverExecResult, HanaClient, type HanaClientInfo, type HanaDriver, type OutputFormat, type PoolOptions, QueryError, type QueryOptions, type QueryResult, type QueryResultColumn, type QueryRow, ReadOnlyViolationError, type SelectSpec, type SqlBackupRecord, type SqlBackupWriteInput, type SqlBackupWriteOptions, type SqlParam, type StatementKind, type TableInfo, Transaction, type WriteBackupOperation, type WriteBackupPlan, buildCount, buildDelete, buildInsert, buildSelect, buildUpdate, buildWriteBackupPlan, cfHanaBackupRoot, connect, createDriver, errorMessage, formatCsv, formatJson, formatResult, formatTable, query, withConnection, writeSqlBackup };
|