Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Changes In Branch tkt-5251bd0878
Excluding Merge-Ins
This is equivalent to a diff from
66703fe6d8
to e21840949d
2015-12-31
| | |
22:50 |
|
check-in: 9f0c9b796f user: mistachkin tags: updates
|
2015-12-15
| | |
01:40 |
|
Closed-Leaf
check-in: e21840949d user: mistachkin tags: tkt-5251bd0878
|
2015-12-12
| | |
04:49 |
|
check-in: 70131d4f23 user: mistachkin tags: trunk
|
02:02 |
|
check-in: 9b51e7a273 user: mistachkin tags: tkt-5251bd0878
|
2015-12-11
| | |
23:10 |
|
check-in: 5f7617eb79 user: mistachkin tags: tkt-5251bd0878
|
2015-12-10
| | |
05:57 |
|
check-in: 66703fe6d8 user: mistachkin tags: trunk
|
05:37 |
|
check-in: 469bee6065 user: mistachkin tags: trunk, release, release-1.0.99.0
|
| | |
Changes to SQLite.Designer/Design/Index.cs.
︙ | | |
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
|
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
|
+
-
+
+
+
+
|
}
internal IndexColumn(Index parent, DataRow row)
{
_parent = parent;
if (row != null)
{
if (!row.IsNull("COLUMN_NAME"))
_column = row["COLUMN_NAME"].ToString();
_column = row["COLUMN_NAME"].ToString();
else
_column = null;
if (row.IsNull("SORT_MODE") == false && (string)row["SORT_MODE"] != "ASC")
_mode = ColumnSortMode.Descending;
if (row.IsNull("COLLATION_NAME") == false)
_collate = row["COLLATION_NAME"].ToString().ToUpperInvariant();
}
}
|
︙ | | |
Changes to Setup/data/verify.lst.
︙ | | |
788
789
790
791
792
793
794
795
796
797
798
799
800
801
|
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
|
+
|
Tests/tkt-3e783eecbe.eagle
Tests/tkt-41aea496e0.eagle
Tests/tkt-448d663d11.eagle
Tests/tkt-47c6fa04d3.eagle
Tests/tkt-47f4bac575.eagle
Tests/tkt-48a6b8e4ca.eagle
Tests/tkt-4a791e70ab.eagle
Tests/tkt-5251bd0878.eagle
Tests/tkt-544dba0a2f.eagle
Tests/tkt-56b42d99c1.eagle
Tests/tkt-58ed318f2f.eagle
Tests/tkt-59edc1018b.eagle
Tests/tkt-6434e23a0f.eagle
Tests/tkt-647d282d11.eagle
Tests/tkt-6c6ecccc5f.eagle
|
︙ | | |
Changes to System.Data.SQLite/SQLiteConnection.cs.
︙ | | |
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
|
4753
4754
4755
4756
4757
4758
4759
4760
4761
4762
4763
4764
4765
4766
4767
4768
4769
4770
4771
4772
4773
4774
4775
4776
4777
4778
4779
4780
4781
4782
4783
4784
4785
4786
4787
4788
4789
4790
4791
4792
4793
|
+
+
-
+
+
+
-
+
-
+
|
try
{
using (SQLiteCommand cmdIndex = new SQLiteCommand(UnsafeNativeMethods.StringFormat(CultureInfo.InvariantCulture, "PRAGMA [{0}].index_info([{1}])", strCatalog, rdIndexes.GetString(1)), this))
using (SQLiteDataReader rdIndex = cmdIndex.ExecuteReader())
{
while (rdIndex.Read())
{
string columnName = rdIndex.IsDBNull(2) ? null : rdIndex.GetString(2);
row = tbl.NewRow();
row["CONSTRAINT_CATALOG"] = strCatalog;
row["CONSTRAINT_NAME"] = rdIndexes.GetString(1);
row["TABLE_CATALOG"] = strCatalog;
row["TABLE_NAME"] = rdIndexes.GetString(2);
row["COLUMN_NAME"] = rdIndex.GetString(2);
row["COLUMN_NAME"] = columnName;
row["INDEX_NAME"] = rdIndexes.GetString(1);
row["ORDINAL_POSITION"] = ordinal; // rdIndex.GetInt32(1);
string collationSequence = null;
int sortMode = 0;
int onError = 0;
if (columnName != null)
_sql.GetIndexColumnExtendedInfo(strCatalog, rdIndexes.GetString(1), rdIndex.GetString(2), ref sortMode, ref onError, ref collationSequence);
_sql.GetIndexColumnExtendedInfo(strCatalog, rdIndexes.GetString(1), columnName, ref sortMode, ref onError, ref collationSequence);
if (String.IsNullOrEmpty(collationSequence) == false)
row["COLLATION_NAME"] = collationSequence;
row["SORT_MODE"] = (sortMode == 0) ? "ASC" : "DESC";
row["CONFLICT_OPTION"] = onError;
ordinal++;
if (String.IsNullOrEmpty(strColumn) || String.Compare(strColumn, row["COLUMN_NAME"].ToString(), StringComparison.OrdinalIgnoreCase) == 0)
if ((strColumn == null) || String.Compare(strColumn, columnName, StringComparison.OrdinalIgnoreCase) == 0)
tbl.Rows.Add(row);
}
}
}
catch (SQLiteException)
{
}
|
︙ | | |
Changes to System.Data.SQLite/SQLiteConvert.cs.
︙ | | |
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
|
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
}
finally
{
if (!found && (connection != null))
connection.SetCachedSetting(name, value);
}
}
/// <summary>
/// Converts the object value, which is assumed to have originated
/// from a <see cref="DataRow" />, to a string value.
/// </summary>
/// <param name="value">
/// The value to be converted to a string.
/// </param>
/// <returns>
/// A null value will be returned if the original value is null -OR-
/// the original value is <see cref="DBNull.Value" />. Otherwise,
/// the original value will be converted to a string, using its
/// (possibly overridden) <see cref="Object.ToString" /> method and
/// then returned.
/// </returns>
public static string GetStringOrNull(
object value
)
{
if (value == null)
return null;
if (value is string)
return (string)value;
if (value == DBNull.Value)
return null;
return value.ToString();
}
/// <summary>
/// Determines if the specified textual value appears to be a
/// <see cref="DBNull" /> value.
/// </summary>
/// <param name="text">
/// The textual value to inspect.
|
︙ | | |
Changes to System.Data.SQLite/SQLiteDataReader.cs.
︙ | | |
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
|
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
|
-
+
|
null,
(string)row[SchemaTableColumn.BaseTableName],
(string)rowIndexes["INDEX_NAME"],
null
});
foreach (DataRow rowColumnIndex in tblIndexColumns.Rows)
{
if (String.Compare((string)rowColumnIndex["COLUMN_NAME"], strColumn, StringComparison.OrdinalIgnoreCase) == 0)
if (String.Compare(SQLiteConvert.GetStringOrNull(rowColumnIndex["COLUMN_NAME"]), strColumn, StringComparison.OrdinalIgnoreCase) == 0)
{
//
// BUGFIX: Make sure that we only flag this column as "unique"
// if we are not processing of some kind of multi-table
// construct (i.e. a join) because in that case we must
// allow duplicate values (refer to ticket [7e3fa93744]).
//
|
︙ | | |
Changes to System.Data.SQLite/SQLiteKeyReader.cs.
︙ | | |
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
|
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
|
+
+
+
-
+
-
+
-
+
|
using (DataTable indexColumns = cnn.GetSchema("IndexColumns", new string[] { pair.Key, null, table, (string)preferredRow["INDEX_NAME"] }))
{
KeyQuery query = null;
List<string> cols = new List<string>();
for (int x = 0; x < indexColumns.Rows.Count; x++)
{
string columnName = SQLiteConvert.GetStringOrNull(
indexColumns.Rows[x]["COLUMN_NAME"]);
bool addKey = true;
// If the column in the index already appears in the query, skip it
foreach (DataRow row in schema.Rows)
{
if (row.IsNull(SchemaTableColumn.BaseColumnName))
continue;
if ((string)row[SchemaTableColumn.BaseColumnName] == (string)indexColumns.Rows[x]["COLUMN_NAME"] &&
if ((string)row[SchemaTableColumn.BaseColumnName] == columnName &&
(string)row[SchemaTableColumn.BaseTableName] == table &&
(string)row[SchemaTableOptionalColumn.BaseCatalogName] == pair.Key)
{
indexColumns.Rows.RemoveAt(x);
x--;
addKey = false;
break;
}
}
if (addKey == true)
cols.Add((string)indexColumns.Rows[x]["COLUMN_NAME"]);
cols.Add(columnName);
}
// If the index is not a rowid alias, record all the columns
// needed to make up the unique index and construct a SQL query for it
if ((string)preferredRow["INDEX_NAME"] != "sqlite_master_PK_" + table)
{
// Whatever remains of the columns we need that make up the index that are not
// already in the query need to be queried separately, so construct a subquery
if (cols.Count > 0)
{
string[] querycols = new string[cols.Count];
cols.CopyTo(querycols);
query = new KeyQuery(cnn, pair.Key, table, querycols);
}
}
// Create a KeyInfo struct for each column of the index
for (int x = 0; x < indexColumns.Rows.Count; x++)
{
string columnName = (string)indexColumns.Rows[x]["COLUMN_NAME"];
string columnName = SQLiteConvert.GetStringOrNull(indexColumns.Rows[x]["COLUMN_NAME"]);
KeyInfo key = new KeyInfo();
key.rootPage = rootPage;
key.cursor = cursor;
key.database = database;
key.databaseName = pair.Key;
key.tableName = table;
|
︙ | | |
Added Tests/tkt-5251bd0878.eagle.
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
###############################################################################
#
# tkt-5251bd0878.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################
package require Eagle
package require Eagle.Library
package require Eagle.Test
runTestPrologue
###############################################################################
package require System.Data.SQLite.Test
runSQLiteTestPrologue
###############################################################################
runTest {test tkt-5251bd0878-1.1 {indexed expressions schema} -setup {
setupDb [set fileName tkt-5251bd0878-1.1.db]
} -body {
set connection [getDbConnection]
sql execute $db {
CREATE TABLE t1(x INTEGER PRIMARY KEY, y INTEGER);
INSERT INTO t1 (y) VALUES (-2000);
INSERT INTO t1 (y) VALUES (-1000);
INSERT INTO t1 (y) VALUES (-200);
INSERT INTO t1 (y) VALUES (-100);
INSERT INTO t1 (y) VALUES (-20);
INSERT INTO t1 (y) VALUES (-10);
INSERT INTO t1 (y) VALUES (0);
INSERT INTO t1 (y) VALUES (10);
INSERT INTO t1 (y) VALUES (20);
INSERT INTO t1 (y) VALUES (100);
INSERT INTO t1 (y) VALUES (200);
INSERT INTO t1 (y) VALUES (1000);
INSERT INTO t1 (y) VALUES (2000);
INSERT INTO t1 (y) VALUES (10000);
INSERT INTO t1 (y) VALUES (20000);
CREATE INDEX i1 ON t1(x, abs(y));
}
set dataReader [sql execute -execute reader -format datareader \
-alias $db "SELECT x, y FROM t1;"]
set dataTable [$dataReader -alias GetSchemaTable]
set result [list]
foreach row [getRowsFromDataTable $dataTable] {
foreach column $row {
if {[lindex $column 0] in [list ColumnName IsKey]} then {
lappend result $column
}
}
}
set result
} -cleanup {
unset -nocomplain dataTable dataReader
cleanupDb $fileName
freeDbConnection
unset -nocomplain column row result connection db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite} -result {{ColumnName x} {IsKey True} {ColumnName y} {IsKey\
False}}}
###############################################################################
runSQLiteTestEpilogue
runTestEpilogue
|
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |