-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Pallab Maiti
authored
Sep 19, 2023
1 parent
7a590f0
commit 0efaffa
Showing
30 changed files
with
604 additions
and
263,915 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
Examples/RudderSampleAppObjC/RudderSampleAppObjC/EncryptedDatabaseProvider.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// | ||
// EncryptedDatabaseProvider.h | ||
// RudderDatabaseEncryption | ||
// | ||
// Created by Pallab Maiti on 14/09/23. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import <Rudder/Rudder.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface EncryptedDatabaseProvider : NSObject<RSDatabaseProvider> | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
64 changes: 64 additions & 0 deletions
64
Examples/RudderSampleAppObjC/RudderSampleAppObjC/EncryptedDatabaseProvider.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// | ||
// EncryptedDatabaseProvider.m | ||
// RudderDatabaseEncryption | ||
// | ||
// Created by Pallab Maiti on 14/09/23. | ||
// | ||
|
||
#import "EncryptedDatabaseProvider.h" | ||
#import "sqlite3.h" | ||
|
||
@interface RSEncryptedDatabase : NSObject <RSDatabase> | ||
|
||
@end | ||
|
||
@implementation RSEncryptedDatabase { | ||
sqlite3 *db; | ||
} | ||
|
||
- (int)open_v2:(const char *)filename flags:(int)flags zVfs:(const char *)zVfs { | ||
return sqlite3_open_v2(filename, &db, flags, zVfs); | ||
} | ||
|
||
|
||
- (int)exec:(const char *)zSql xCallback:(callback)xCallback pArg:(void *)pArg pzErrMsg:(char * _Nullable *)pzErrMsg { | ||
return sqlite3_exec(db, zSql, xCallback, pArg, pzErrMsg); | ||
} | ||
|
||
- (int)close { | ||
return sqlite3_close(db); | ||
} | ||
|
||
- (int)step:(void *)pStmt { | ||
return sqlite3_step(pStmt); | ||
} | ||
|
||
- (int)finalize:(void *)pStmt { | ||
return sqlite3_finalize(pStmt); | ||
} | ||
|
||
- (int)prepare_v2:(const char *)zSql nBytes:(int)nBytes ppStmt:(void **)ppStmt pzTail:(const char **)pzTail { | ||
return sqlite3_prepare_v2(db, zSql, nBytes, (sqlite3_stmt **)(ppStmt), pzTail); | ||
} | ||
|
||
- (int)column_int:(void *)pStmt i:(int)i { | ||
return sqlite3_column_int(pStmt, i); | ||
} | ||
|
||
- (const unsigned char *)column_text:(void *)pStmt i:(int)i { | ||
return sqlite3_column_text(pStmt, i); | ||
} | ||
|
||
- (int)key:(const void *)pKey nKey:(int)nKey { | ||
return sqlite3_key(db, pKey, nKey); | ||
} | ||
|
||
@end | ||
|
||
@implementation EncryptedDatabaseProvider | ||
|
||
- (id<RSDatabase>)getDatabase { | ||
return [RSEncryptedDatabase new]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
Examples/RudderSampleAppSwift/RudderSampleAppSwift/EncryptedDatabaseProvider.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// | ||
// EncryptedDatabaseProvider.swift | ||
// RudderSampleAppSwift | ||
// | ||
// Created by Pallab Maiti on 14/09/23. | ||
// Copyright © 2023 RudderStack. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import Rudder | ||
|
||
class EncryptedDatabase: RSDatabase { | ||
|
||
private var db: OpaquePointer? | ||
|
||
func open_v2(_ filename: UnsafePointer<CChar>?, flags: Int32, zVfs: UnsafePointer<CChar>?) -> Int32 { | ||
return sqlite3_open_v2(filename, &db, flags, zVfs) | ||
} | ||
|
||
func exec(_ zSql: UnsafePointer<CChar>?, xCallback: callback?, pArg: UnsafeMutableRawPointer?, pzErrMsg: UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>?) -> Int32 { | ||
return sqlite3_exec(db, zSql, xCallback, pArg, pzErrMsg) | ||
} | ||
|
||
func prepare_v2(_ zSql: UnsafePointer<CChar>?, nBytes: Int32, ppStmt: UnsafeMutablePointer<UnsafeMutableRawPointer?>?, pzTail: UnsafeMutablePointer<UnsafePointer<CChar>?>?) -> Int32 { | ||
return sqlite3_prepare_v2(db, zSql, nBytes, UnsafeMutablePointer(OpaquePointer(ppStmt)), pzTail) | ||
} | ||
|
||
func close() -> Int32 { | ||
return sqlite3_close(db) | ||
} | ||
|
||
func step(_ pStmt: UnsafeMutableRawPointer?) -> Int32 { | ||
return sqlite3_step(OpaquePointer(pStmt)) | ||
} | ||
|
||
func finalize(_ pStmt: UnsafeMutableRawPointer?) -> Int32 { | ||
return sqlite3_finalize(OpaquePointer(pStmt)) | ||
} | ||
|
||
func column_int(_ pStmt: UnsafeMutableRawPointer?, i: Int32) -> Int32 { | ||
return sqlite3_column_int(OpaquePointer(pStmt), i) | ||
} | ||
|
||
func column_text(_ pStmt: UnsafeMutableRawPointer?, i: Int32) -> UnsafePointer<UInt8> { | ||
return sqlite3_column_text(OpaquePointer(pStmt), i) | ||
} | ||
|
||
func key(_ pKey: UnsafeRawPointer?, nKey: Int32) -> Int32 { | ||
return sqlite3_key(db, pKey, nKey) | ||
} | ||
} | ||
|
||
class EncryptedDatabaseProvider: RSDatabaseProvider { | ||
func getDatabase() -> RSDatabase { | ||
return EncryptedDatabase() | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
Examples/RudderSampleAppSwift/RudderSampleAppSwift/RudderSampleAppSwift-Bridging-Header.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// | ||
// RudderSampleAppSwift-Bridging-Header.h | ||
// RudderSampleAppSwift | ||
// | ||
// Created by Pallab Maiti on 15/09/23. | ||
// Copyright © 2023 RudderStack. All rights reserved. | ||
// | ||
|
||
#ifndef RudderSampleAppSwift_Bridging_Header_h | ||
#define RudderSampleAppSwift_Bridging_Header_h | ||
|
||
#import "sqlite3.h" | ||
|
||
#endif /* RudderSampleAppSwift_Bridging_Header_h */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.