/ Check-in [27d4b6f5]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add tests for views to hidden.test.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | hidden-columns-in-tables
Files: files | file ages | folders
SHA1: 27d4b6f5756c7b19c00c95d46a77280c8b6f03a4
User & Date: dan 2015-11-18 20:59:47
Context
2015-11-18
21:22
Get the __hidden__ column mechanism working on views with INSTEAD OF triggers. check-in: 20c1e9ce user: drh tags: hidden-columns-in-tables
20:59
Add tests for views to hidden.test. check-in: 27d4b6f5 user: dan tags: hidden-columns-in-tables
20:57
Honor the "__hidden__" prefix on the columns of views. check-in: 3071ba2b user: drh tags: hidden-columns-in-tables
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to test/hidden.test.

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
  SELECT * FROM t1;
} {1 y}

do_execsql_test 1.3 {
  SELECT __hidden__a, * FROM t1;
} {{} 1 x y}





#do_execsql_test 2.1 {

  #CREATE TABLE x1(a, b, c);
  #INSERT INTO x1 VALUES(1, 2, 3);






  #CREATE VIEW v1(a, b, __hidden__c) AS SELECT a, b, c FROM x1;



  #SELECT * FROM v1;
#} {1 2}

do_execsql_test 2.2 {
  PRAGMA table_info(v1);
} {
0 a {} 0 {} 0 
1 b {} 0 {} 0 
2 __hidden__c {} 0 {} 0



}













  
finish_test







>
>
>
>
|
>
|
|
>
>
>
>
>
>
|
>
>
>
|
|
|
|
<
<
<
<
<
>
>
>
|
>
>
>
>
>
>
>
>
>
>





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
  SELECT * FROM t1;
} {1 y}

do_execsql_test 1.3 {
  SELECT __hidden__a, * FROM t1;
} {{} 1 x y}

foreach {tn view} {
  1 { CREATE VIEW v1(a, b, __hidden__c) AS SELECT a, b, c FROM x1 }
  2 { CREATE VIEW v1 AS SELECT a, b, c AS __hidden__c FROM x1 }
} {
  do_execsql_test 2.$tn.1 {
    DROP TABLE IF EXISTS x1;
    CREATE TABLE x1(a, b, c);
    INSERT INTO x1 VALUES(1, 2, 3);
  }

  catchsql { DROP VIEW v1 }
  execsql $view

  do_execsql_test 2.$tn.2 {
    SELECT a, b, __hidden__c FROM v1;
  } {1 2 3}
  
  do_execsql_test 2.$tn.3 {
    SELECT * FROM v1;
  } {1 2}
  
  do_execsql_test 2.$tn.4 {





    CREATE TRIGGER tr1 INSTEAD OF INSERT ON v1 BEGIN
      INSERT INTO x1 VALUES(new.a, new.b, new.__hidden__c);
    END;
  
    INSERT INTO v1 VALUES(4, 5);
    SELECT * FROM x1;
  } {1 2 3 4 5 {}}
  
  do_execsql_test 2.$tn.5 {
    INSERT INTO v1(a, b, __hidden__c) VALUES(7, 8, 9);
    SELECT * FROM x1;
  } {1 2 3 4 5 {} 7 8 9}
}




  
finish_test