Skip to content

Commit

Permalink
Windows support
Browse files Browse the repository at this point in the history
  • Loading branch information
arasan01 committed Feb 20, 2024
1 parent 0437c0f commit c5d8e7a
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
2 changes: 2 additions & 0 deletions GRDB/Core/StatementAuthorizer.swift
@@ -1,5 +1,7 @@
#if os(Linux)
import Glibc
#elseif os(Windows)
import ucrt
#endif

/// `StatementAuthorizer` provides information about compiled database
Expand Down
2 changes: 1 addition & 1 deletion GRDB/Core/Support/Foundation/NSNumber.swift
@@ -1,4 +1,4 @@
#if !os(Linux)
#if !os(Linux) && !os(Windows)
import Foundation

private let integerRoundingBehavior = NSDecimalNumberHandler(
Expand Down
6 changes: 3 additions & 3 deletions GRDB/Core/Support/Foundation/URL.swift
@@ -1,14 +1,14 @@
import Foundation

#if !os(Linux)
#if !os(Linux) && !os(Windows)
/// NSURL stores its absoluteString in the database.
extension NSURL: DatabaseValueConvertible {

/// Returns a TEXT database value containing the absolute URL.
public var databaseValue: DatabaseValue {
absoluteString?.databaseValue ?? .null
}

public static func fromDatabaseValue(_ dbValue: DatabaseValue) -> Self? {
guard let string = String.fromDatabaseValue(dbValue) else {
return nil
Expand Down
6 changes: 3 additions & 3 deletions GRDB/Core/Support/Foundation/UUID.swift
@@ -1,6 +1,6 @@
import Foundation

#if !os(Linux)
#if !os(Linux) && !os(Windows)
/// NSUUID adopts DatabaseValueConvertible
extension NSUUID: DatabaseValueConvertible {
/// Returns a BLOB database value containing the uuid bytes.
Expand All @@ -11,7 +11,7 @@ extension NSUUID: DatabaseValueConvertible {
return NSData(bytes: buffer.baseAddress, length: 16).databaseValue
}
}

/// Returns a `NSUUID` from the specified database value.
///
/// If the database value contains a string, parses this string as an uuid.
Expand Down Expand Up @@ -43,7 +43,7 @@ extension UUID: DatabaseValueConvertible {
Data(bytes: $0.baseAddress!, count: $0.count).databaseValue
}
}

/// Returns a `UUID` from the specified database value.
///
/// If the database value contains a string, parses this string as an uuid.
Expand Down
1 change: 1 addition & 0 deletions Package.swift
Expand Up @@ -48,6 +48,7 @@ let package = Package(
targets: [
.systemLibrary(
name: "CSQLite",
pkgConfig: "sqlite3",
providers: [.apt(["libsqlite3-dev"])]),
.target(
name: "GRDB",
Expand Down

0 comments on commit c5d8e7a

Please sign in to comment.