Skip to content

Commit 6940620

Browse files
committed
1 parent 0d7de6c commit 6940620

File tree

5 files changed

+121
-14
lines changed

5 files changed

+121
-14
lines changed

SQLite.xcodeproj/project.pbxproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@
112112
92EF2EB3248F9B06002C8EF9 /* Backup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92EF2EB1248F9ADE002C8EF9 /* Backup.swift */; };
113113
92EF2EB4248F9B07002C8EF9 /* Backup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92EF2EB1248F9ADE002C8EF9 /* Backup.swift */; };
114114
92EF2EB5248F9B08002C8EF9 /* Backup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92EF2EB1248F9ADE002C8EF9 /* Backup.swift */; };
115+
92EF2EBA248FA477002C8EF9 /* SelectTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92EF2EB6248FA46D002C8EF9 /* SelectTests.swift */; };
116+
92EF2EBB248FA478002C8EF9 /* SelectTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92EF2EB6248FA46D002C8EF9 /* SelectTests.swift */; };
117+
92EF2EBC248FA479002C8EF9 /* SelectTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92EF2EB6248FA46D002C8EF9 /* SelectTests.swift */; };
115118
EE247AD71C3F04ED00AE3E12 /* SQLite.h in Headers */ = {isa = PBXBuildFile; fileRef = EE247AD61C3F04ED00AE3E12 /* SQLite.h */; settings = {ATTRIBUTES = (Public, ); }; };
116119
EE247ADE1C3F04ED00AE3E12 /* SQLite.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EE247AD31C3F04ED00AE3E12 /* SQLite.framework */; };
117120
EE247B031C3F06E900AE3E12 /* Blob.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE247AEE1C3F06E900AE3E12 /* Blob.swift */; };
@@ -232,6 +235,7 @@
232235
3D67B3E51DB2469200A4F4C6 /* libsqlite3.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libsqlite3.tbd; path = Platforms/WatchOS.platform/Developer/SDKs/WatchOS3.0.sdk/usr/lib/libsqlite3.tbd; sourceTree = DEVELOPER_DIR; };
233236
49EB68C31F7B3CB400D89D40 /* Coding.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Coding.swift; sourceTree = "<group>"; };
234237
92EF2EB1248F9ADE002C8EF9 /* Backup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Backup.swift; sourceTree = "<group>"; };
238+
92EF2EB6248FA46D002C8EF9 /* SelectTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectTests.swift; sourceTree = "<group>"; };
235239
A121AC451CA35C79005A31D1 /* SQLite.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SQLite.framework; sourceTree = BUILT_PRODUCTS_DIR; };
236240
EE247AD31C3F04ED00AE3E12 /* SQLite.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SQLite.framework; sourceTree = BUILT_PRODUCTS_DIR; };
237241
EE247AD61C3F04ED00AE3E12 /* SQLite.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SQLite.h; sourceTree = "<group>"; };
@@ -423,6 +427,7 @@
423427
19A17B93B48B5560E6E51791 /* Fixtures.swift */,
424428
19A175C1F9CB3BBAB8FCEC7B /* RowTests.swift */,
425429
19A1729B75C33F9A0B9A89C1 /* DateAndTimeFunctionTests.swift */,
430+
92EF2EB6248FA46D002C8EF9 /* SelectTests.swift */,
426431
);
427432
name = SQLiteTests;
428433
path = Tests/SQLiteTests;
@@ -854,6 +859,7 @@
854859
19A17F60B685636D1F83C2DD /* Fixtures.swift in Sources */,
855860
19A1785195182AF8731A8BDA /* RowTests.swift in Sources */,
856861
19A1769C1F3A7542BECF50FF /* DateAndTimeFunctionTests.swift in Sources */,
862+
92EF2EBC248FA479002C8EF9 /* SelectTests.swift in Sources */,
857863
);
858864
runOnlyForDeploymentPostprocessing = 0;
859865
};
@@ -944,6 +950,7 @@
944950
19A17408007B182F884E3A53 /* Fixtures.swift in Sources */,
945951
19A1720B67ED13E6150C6A3D /* RowTests.swift in Sources */,
946952
19A17C80076860CF7751A056 /* DateAndTimeFunctionTests.swift in Sources */,
953+
92EF2EBA248FA477002C8EF9 /* SelectTests.swift in Sources */,
947954
);
948955
runOnlyForDeploymentPostprocessing = 0;
949956
};
@@ -1003,6 +1010,7 @@
10031010
19A1709C3E7A406E62293B2A /* Fixtures.swift in Sources */,
10041011
19A171967CC511C4F6F773C9 /* RowTests.swift in Sources */,
10051012
19A172EB202970561E5C4245 /* DateAndTimeFunctionTests.swift in Sources */,
1013+
92EF2EBB248FA478002C8EF9 /* SelectTests.swift in Sources */,
10061014
);
10071015
runOnlyForDeploymentPostprocessing = 0;
10081016
};

SQLite.xcodeproj/xcshareddata/xcschemes/SQLite iOS.xcscheme

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@
2727
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
2828
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
2929
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<MacroExpansion>
31+
<BuildableReference
32+
BuildableIdentifier = "primary"
33+
BlueprintIdentifier = "EE247AD21C3F04ED00AE3E12"
34+
BuildableName = "SQLite.framework"
35+
BlueprintName = "SQLite iOS"
36+
ReferencedContainer = "container:SQLite.xcodeproj">
37+
</BuildableReference>
38+
</MacroExpansion>
3039
<Testables>
3140
<TestableReference
3241
skipped = "NO">
@@ -39,17 +48,6 @@
3948
</BuildableReference>
4049
</TestableReference>
4150
</Testables>
42-
<MacroExpansion>
43-
<BuildableReference
44-
BuildableIdentifier = "primary"
45-
BlueprintIdentifier = "EE247AD21C3F04ED00AE3E12"
46-
BuildableName = "SQLite.framework"
47-
BlueprintName = "SQLite iOS"
48-
ReferencedContainer = "container:SQLite.xcodeproj">
49-
</BuildableReference>
50-
</MacroExpansion>
51-
<AdditionalOptions>
52-
</AdditionalOptions>
5351
</TestAction>
5452
<LaunchAction
5553
buildConfiguration = "Debug"
@@ -70,8 +68,6 @@
7068
ReferencedContainer = "container:SQLite.xcodeproj">
7169
</BuildableReference>
7270
</MacroExpansion>
73-
<AdditionalOptions>
74-
</AdditionalOptions>
7571
</LaunchAction>
7672
<ProfileAction
7773
buildConfiguration = "Release"
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1150"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
</BuildAction>
9+
<TestAction
10+
buildConfiguration = "Debug"
11+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
12+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
13+
shouldUseLaunchSchemeArgsEnv = "YES">
14+
<Testables>
15+
<TestableReference
16+
skipped = "NO">
17+
<BuildableReference
18+
BuildableIdentifier = "primary"
19+
BlueprintIdentifier = "EE247ADC1C3F04ED00AE3E12"
20+
BuildableName = "SQLiteTests iOS.xctest"
21+
BlueprintName = "SQLiteTests iOS"
22+
ReferencedContainer = "container:SQLite.xcodeproj">
23+
</BuildableReference>
24+
</TestableReference>
25+
</Testables>
26+
</TestAction>
27+
<LaunchAction
28+
buildConfiguration = "Debug"
29+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
30+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
31+
launchStyle = "0"
32+
useCustomWorkingDirectory = "NO"
33+
ignoresPersistentStateOnLaunch = "NO"
34+
debugDocumentVersioning = "YES"
35+
debugServiceExtension = "internal"
36+
allowLocationSimulation = "YES">
37+
</LaunchAction>
38+
<ProfileAction
39+
buildConfiguration = "Release"
40+
shouldUseLaunchSchemeArgsEnv = "YES"
41+
savedToolIdentifier = ""
42+
useCustomWorkingDirectory = "NO"
43+
debugDocumentVersioning = "YES">
44+
</ProfileAction>
45+
<AnalyzeAction
46+
buildConfiguration = "Debug">
47+
</AnalyzeAction>
48+
<ArchiveAction
49+
buildConfiguration = "Release"
50+
revealArchiveInOrganizer = "YES">
51+
</ArchiveAction>
52+
</Scheme>

Sources/SQLite/Typed/Query.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1003,7 +1003,6 @@ extension Connection {
10031003
try expandGlob(true)(q)
10041004
continue column
10051005
}
1006-
throw QueryError.noSuchTable(name: namespace)
10071006
}
10081007
throw QueryError.noSuchTable(name: namespace)
10091008
}

Tests/SQLiteTests/SelectTests.swift

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
//
2+
// SelectTests.swift
3+
// SQLite iOS
4+
//
5+
// Created by Sergei Golishnikov on 09/06/2020.
6+
//
7+
8+
import XCTest
9+
@testable import SQLite
10+
11+
class SelectTests: SQLiteTestCase {
12+
13+
override func setUp() {
14+
super.setUp()
15+
CreateUsersTable()
16+
CreateUsersDataTable()
17+
}
18+
19+
func CreateUsersDataTable() {
20+
try! db.execute("""
21+
CREATE TABLE users_name (
22+
id INTEGER,
23+
user_id INTEGER REFERENCES users(id),
24+
name TEXT
25+
)
26+
"""
27+
)
28+
}
29+
30+
func test_select_columns_from_multiple_tables() {
31+
let usersData = Table("users_name")
32+
let users = Table("users")
33+
34+
let name = Expression<String>("name")
35+
let id = Expression<Int64>("id")
36+
let userID = Expression<Int64>("user_id")
37+
let email = Expression<String>("email")
38+
39+
try! InsertUser("Joey")
40+
try! db.run(usersData.insert(
41+
id <- 1,
42+
userID <- 1,
43+
name <- "Joey"
44+
))
45+
46+
try! db.prepare(users.select(name, email).join(usersData, on: userID == users[id])).forEach {
47+
XCTAssertEqual($0[name], "Joey")
48+
XCTAssertEqual($0[email], "[email protected]")
49+
}
50+
}
51+
52+
}

0 commit comments

Comments
 (0)