@ -378,7 +378,7 @@ export class DocStorage implements ISQLiteDB, OnDemandStorage {
const colListSql = newCols . map ( c = > ` ${ quoteIdent ( c . colId ) } =? ` ) . join ( ', ' ) ;
const colListSql = newCols . map ( c = > ` ${ quoteIdent ( c . colId ) } =? ` ) . join ( ', ' ) ;
const types = newCols . map ( c = > c . type ) ;
const types = newCols . map ( c = > c . type ) ;
const sqlParams = DocStorage . _encodeColumnsToRows ( types , newCols . map ( c = > [ PENDING_VALUE ] ) ) ;
const sqlParams = DocStorage . _encodeColumnsToRows ( types , newCols . map ( c = > [ PENDING_VALUE ] ) ) ;
await db . run ( ` UPDATE ${ quoteIdent ( tableId ) } SET ${ colListSql } ` , sqlParams [ 0 ] ) ;
await db . run ( ` UPDATE ${ quoteIdent ( tableId ) } SET ${ colListSql } ` , . . . sqlParams [ 0 ] ) ;
}
}
} ,
} ,
@ -1093,7 +1093,7 @@ export class DocStorage implements ISQLiteDB, OnDemandStorage {
public _process_RemoveRecord ( tableId : string , rowId : string ) : Promise < RunResult > {
public _process_RemoveRecord ( tableId : string , rowId : string ) : Promise < RunResult > {
const sql = "DELETE FROM " + quoteIdent ( tableId ) + " WHERE id=?" ;
const sql = "DELETE FROM " + quoteIdent ( tableId ) + " WHERE id=?" ;
debuglog ( "RemoveRecord SQL: " + sql , [ rowId ] ) ;
debuglog ( "RemoveRecord SQL: " + sql , [ rowId ] ) ;
return this . run ( sql , [ rowId ] ) ;
return this . run ( sql , rowId ) ;
}
}
@ -1130,7 +1130,7 @@ export class DocStorage implements ISQLiteDB, OnDemandStorage {
const stmt = await this . prepare ( preSql + chunkParams + postSql ) ;
const stmt = await this . prepare ( preSql + chunkParams + postSql ) ;
for ( const index of _ . range ( 0 , numChunks * chunkSize , chunkSize ) ) {
for ( const index of _ . range ( 0 , numChunks * chunkSize , chunkSize ) ) {
debuglog ( "DocStorage.BulkRemoveRecord: chunk delete " + index + "-" + ( index + chunkSize - 1 ) ) ;
debuglog ( "DocStorage.BulkRemoveRecord: chunk delete " + index + "-" + ( index + chunkSize - 1 ) ) ;
await stmt . run ( rowIds . slice ( index , index + chunkSize ) ) ;
await stmt . run ( . . . rowIds . slice ( index , index + chunkSize ) ) ;
}
}
await stmt . finalize ( ) ;
await stmt . finalize ( ) ;
}
}
@ -1139,7 +1139,7 @@ export class DocStorage implements ISQLiteDB, OnDemandStorage {
debuglog ( "DocStorage.BulkRemoveRecord: leftover delete " + ( numChunks * chunkSize ) + "-" + ( rowIds . length - 1 ) ) ;
debuglog ( "DocStorage.BulkRemoveRecord: leftover delete " + ( numChunks * chunkSize ) + "-" + ( rowIds . length - 1 ) ) ;
const leftoverParams = _ . range ( numLeftovers ) . map ( q ) . join ( ',' ) ;
const leftoverParams = _ . range ( numLeftovers ) . map ( q ) . join ( ',' ) ;
await this . run ( preSql + leftoverParams + postSql ,
await this . run ( preSql + leftoverParams + postSql ,
rowIds . slice ( numChunks * chunkSize , rowIds . length ) ) ;
. . . rowIds . slice ( numChunks * chunkSize , rowIds . length ) ) ;
}
}
}
}