File tree Expand file tree Collapse file tree
web/src/db/adapters/wa-sqlite Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -45,12 +45,12 @@ const main = async () => {
4545 openWorker : customWorker ,
4646 initializeConnection : async ( db ) => {
4747 if ( encryptionKey . length ) {
48- const escapedKey = encryptionKey . replace ( "'" , "''" ) ;
49- await db . execute ( `pragma key = '${ escapedKey } '` ) ;
48+ const escapedKey = encryptionKey . replaceAll ( "'" , "''" ) ;
49+ await db . execute ( `PRAGMA key = '${ escapedKey } '` ) ;
5050 }
5151
5252 // Make sure the database is readable, this fails early if the key is wrong.
53- await db . execute ( 'pragma user_version' ) ;
53+ await db . execute ( 'PRAGMA user_version' ) ;
5454 }
5555 } ,
5656 logger
Original file line number Diff line number Diff line change @@ -141,12 +141,12 @@ const db = new PowerSyncDatabase({
141141 },
142142 initializeConnection : async (db ) => {
143143 if (encryptionKey .length ) {
144- const escapedKey = encryptionKey .replace (" '" , " ''" );
145- await db .execute (` pragma key = '${escapedKey }'` );
144+ const escapedKey = encryptionKey .replaceAll (" '" , " ''" );
145+ await db .execute (` PRAGMA key = '${escapedKey }'` );
146146 }
147147
148148 // Make sure the database is readable, this fails early if the key is wrong.
149- await db .execute (' pragma user_version' );
149+ await db .execute (' PRAGMA user_version' );
150150 }
151151 },
152152 logger
Original file line number Diff line number Diff line change @@ -55,8 +55,8 @@ export class RawSqliteConnection {
5555 ) ;
5656 await this . executeRaw ( `PRAGMA temp_store = ${ this . options . temporaryStorage } ;` ) ;
5757 if ( this . options . encryptionKey ) {
58- const escapedKey = this . options . encryptionKey . replace ( "'" , "''" ) ;
59- await this . executeRaw ( `PRAGMA key = '${ escapedKey } '` ) ;
58+ const escapedKey = this . options . encryptionKey . replaceAll ( "'" , "''" ) ;
59+ await this . executeRaw ( `PRAGMA key = '${ escapedKey } '; ` ) ;
6060 }
6161 await this . executeRaw ( `PRAGMA cache_size = -${ this . options . cacheSizeKb } ;` ) ;
6262
You can’t perform that action at this time.
0 commit comments