⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 auth.test

📁 sqlite-3.4.1,嵌入式数据库.是一个功能强大的开源数据库,给学习和研发以及小型公司的发展带来了全所未有的好处.
💻 TEST
📖 第 1 页 / 共 4 页
字号:
do_test auth-1.168 {  execsql {SELECT name FROM sqlite_temp_master}} {t1 r1}do_test auth-1.169 {  proc auth {code arg1 arg2 arg3 arg4} {    if {$code=="SQLITE_DELETE" && $arg1=="sqlite_temp_master"} {      return SQLITE_IGNORE    }    return SQLITE_OK  }  catchsql {DROP TRIGGER r1}} {0 {}}do_test auth-1.170 {  execsql {SELECT name FROM sqlite_temp_master}} {t1 r1}do_test auth-1.171 {  proc auth {code arg1 arg2 arg3 arg4} {    if {$code=="SQLITE_DROP_TEMP_TRIGGER"} {      set ::authargs [list $arg1 $arg2 $arg3 $arg4]      return SQLITE_IGNORE    }    return SQLITE_OK  }  catchsql {DROP TRIGGER r1}} {0 {}}do_test auth-1.172 {  set ::authargs} {r1 t1 temp {}}do_test auth-1.173 {  execsql {SELECT name FROM sqlite_temp_master}} {t1 r1}do_test auth-1.174 {  proc auth {code arg1 arg2 arg3 arg4} {    if {$code=="SQLITE_DROP_TEMP_TRIGGER"} {      set ::authargs [list $arg1 $arg2 $arg3 $arg4]      return SQLITE_OK    }    return SQLITE_OK  }  catchsql {DROP TRIGGER r1}} {0 {}}do_test auth-1.175 {  set ::authargs} {r1 t1 temp {}}do_test auth-1.176 {  execsql {SELECT name FROM sqlite_temp_master}} {t1}} ;# ifcapable triggerdo_test auth-1.177 {  proc auth {code arg1 arg2 arg3 arg4} {    if {$code=="SQLITE_CREATE_INDEX"} {      set ::authargs [list $arg1 $arg2 $arg3 $arg4]      return SQLITE_DENY    }    return SQLITE_OK  }  catchsql {CREATE INDEX i2 ON t2(a)}} {1 {not authorized}}do_test auth-1.178 {  set ::authargs} {i2 t2 main {}}do_test auth-1.179 {  execsql {SELECT name FROM sqlite_master}} {t2}do_test auth-1.180 {  proc auth {code arg1 arg2 arg3 arg4} {    if {$code=="SQLITE_INSERT" && $arg1=="sqlite_master"} {      return SQLITE_DENY    }    return SQLITE_OK  }  catchsql {CREATE INDEX i2 ON t2(a)}} {1 {not authorized}}do_test auth-1.181 {  execsql {SELECT name FROM sqlite_master}} {t2}do_test auth-1.182 {  proc auth {code arg1 arg2 arg3 arg4} {    if {$code=="SQLITE_CREATE_INDEX"} {      set ::authargs [list $arg1 $arg2 $arg3 $arg4]      return SQLITE_IGNORE    }    return SQLITE_OK  }  catchsql {CREATE INDEX i2 ON t2(b)}} {0 {}}do_test auth-1.183 {  set ::authargs} {i2 t2 main {}}do_test auth-1.184 {  execsql {SELECT name FROM sqlite_master}} {t2}do_test auth-1.185 {  proc auth {code arg1 arg2 arg3 arg4} {    if {$code=="SQLITE_INSERT" && $arg1=="sqlite_master"} {      return SQLITE_IGNORE    }    return SQLITE_OK  }  catchsql {CREATE INDEX i2 ON t2(b)}} {0 {}}do_test auth-1.186 {  execsql {SELECT name FROM sqlite_master}} {t2}do_test auth-1.187 {  proc auth {code arg1 arg2 arg3 arg4} {    if {$code=="SQLITE_CREATE_INDEX"} {      set ::authargs [list $arg1 $arg2 $arg3 $arg4]      return SQLITE_OK    }    return SQLITE_OK  }  catchsql {CREATE INDEX i2 ON t2(a)}} {0 {}}do_test auth-1.188 {  set ::authargs} {i2 t2 main {}}do_test auth-1.189 {  execsql {SELECT name FROM sqlite_master}} {t2 i2}ifcapable tempdb {  do_test auth-1.190 {    proc auth {code arg1 arg2 arg3 arg4} {      if {$code=="SQLITE_CREATE_TEMP_INDEX"} {        set ::authargs [list $arg1 $arg2 $arg3 $arg4]        return SQLITE_DENY      }      return SQLITE_OK    }    catchsql {CREATE INDEX i1 ON t1(a)}  } {1 {not authorized}}  do_test auth-1.191 {    set ::authargs  } {i1 t1 temp {}}  do_test auth-1.192 {    execsql {SELECT name FROM sqlite_temp_master}  } {t1}  do_test auth-1.193 {    proc auth {code arg1 arg2 arg3 arg4} {      if {$code=="SQLITE_INSERT" && $arg1=="sqlite_temp_master"} {        return SQLITE_DENY      }      return SQLITE_OK    }    catchsql {CREATE INDEX i1 ON t1(b)}  } {1 {not authorized}}  do_test auth-1.194 {    execsql {SELECT name FROM sqlite_temp_master}  } {t1}  do_test auth-1.195 {    proc auth {code arg1 arg2 arg3 arg4} {      if {$code=="SQLITE_CREATE_TEMP_INDEX"} {        set ::authargs [list $arg1 $arg2 $arg3 $arg4]        return SQLITE_IGNORE      }      return SQLITE_OK    }    catchsql {CREATE INDEX i1 ON t1(b)}  } {0 {}}  do_test auth-1.196 {    set ::authargs  } {i1 t1 temp {}}  do_test auth-1.197 {    execsql {SELECT name FROM sqlite_temp_master}  } {t1}  do_test auth-1.198 {    proc auth {code arg1 arg2 arg3 arg4} {      if {$code=="SQLITE_INSERT" && $arg1=="sqlite_temp_master"} {        return SQLITE_IGNORE      }      return SQLITE_OK    }    catchsql {CREATE INDEX i1 ON t1(c)}  } {0 {}}  do_test auth-1.199 {    execsql {SELECT name FROM sqlite_temp_master}  } {t1}  do_test auth-1.200 {    proc auth {code arg1 arg2 arg3 arg4} {      if {$code=="SQLITE_CREATE_TEMP_INDEX"} {        set ::authargs [list $arg1 $arg2 $arg3 $arg4]        return SQLITE_OK      }      return SQLITE_OK    }    catchsql {CREATE INDEX i1 ON t1(a)}  } {0 {}}  do_test auth-1.201 {    set ::authargs  } {i1 t1 temp {}}  do_test auth-1.202 {    execsql {SELECT name FROM sqlite_temp_master}  } {t1 i1}}do_test auth-1.203 {  proc auth {code arg1 arg2 arg3 arg4} {    if {$code=="SQLITE_DELETE" && $arg1=="sqlite_master"} {      return SQLITE_DENY    }    return SQLITE_OK  }  catchsql {DROP INDEX i2}} {1 {not authorized}}do_test auth-1.204 {  execsql {SELECT name FROM sqlite_master}} {t2 i2}do_test auth-1.205 {  proc auth {code arg1 arg2 arg3 arg4} {    if {$code=="SQLITE_DROP_INDEX"} {      set ::authargs [list $arg1 $arg2 $arg3 $arg4]      return SQLITE_DENY    }    return SQLITE_OK  }  catchsql {DROP INDEX i2}} {1 {not authorized}}do_test auth-1.206 {  set ::authargs} {i2 t2 main {}}do_test auth-1.207 {  execsql {SELECT name FROM sqlite_master}} {t2 i2}do_test auth-1.208 {  proc auth {code arg1 arg2 arg3 arg4} {    if {$code=="SQLITE_DELETE" && $arg1=="sqlite_master"} {      return SQLITE_IGNORE    }    return SQLITE_OK  }  catchsql {DROP INDEX i2}} {0 {}}do_test auth-1.209 {  execsql {SELECT name FROM sqlite_master}} {t2 i2}do_test auth-1.210 {  proc auth {code arg1 arg2 arg3 arg4} {    if {$code=="SQLITE_DROP_INDEX"} {      set ::authargs [list $arg1 $arg2 $arg3 $arg4]      return SQLITE_IGNORE    }    return SQLITE_OK  }  catchsql {DROP INDEX i2}} {0 {}}do_test auth-1.211 {  set ::authargs} {i2 t2 main {}}do_test auth-1.212 {  execsql {SELECT name FROM sqlite_master}} {t2 i2}do_test auth-1.213 {  proc auth {code arg1 arg2 arg3 arg4} {    if {$code=="SQLITE_DROP_INDEX"} {      set ::authargs [list $arg1 $arg2 $arg3 $arg4]      return SQLITE_OK    }    return SQLITE_OK  }  catchsql {DROP INDEX i2}} {0 {}}do_test auth-1.214 {  set ::authargs} {i2 t2 main {}}do_test auth-1.215 {  execsql {SELECT name FROM sqlite_master}} {t2}ifcapable tempdb {  do_test auth-1.216 {    proc auth {code arg1 arg2 arg3 arg4} {      if {$code=="SQLITE_DELETE" && $arg1=="sqlite_temp_master"} {        return SQLITE_DENY      }      return SQLITE_OK    }    catchsql {DROP INDEX i1}  } {1 {not authorized}}  do_test auth-1.217 {    execsql {SELECT name FROM sqlite_temp_master}  } {t1 i1}  do_test auth-1.218 {    proc auth {code arg1 arg2 arg3 arg4} {      if {$code=="SQLITE_DROP_TEMP_INDEX"} {        set ::authargs [list $arg1 $arg2 $arg3 $arg4]        return SQLITE_DENY      }      return SQLITE_OK    }    catchsql {DROP INDEX i1}  } {1 {not authorized}}  do_test auth-1.219 {    set ::authargs  } {i1 t1 temp {}}  do_test auth-1.220 {    execsql {SELECT name FROM sqlite_temp_master}  } {t1 i1}  do_test auth-1.221 {    proc auth {code arg1 arg2 arg3 arg4} {      if {$code=="SQLITE_DELETE" && $arg1=="sqlite_temp_master"} {        return SQLITE_IGNORE      }      return SQLITE_OK    }    catchsql {DROP INDEX i1}  } {0 {}}  do_test auth-1.222 {    execsql {SELECT name FROM sqlite_temp_master}  } {t1 i1}  do_test auth-1.223 {    proc auth {code arg1 arg2 arg3 arg4} {      if {$code=="SQLITE_DROP_TEMP_INDEX"} {        set ::authargs [list $arg1 $arg2 $arg3 $arg4]        return SQLITE_IGNORE      }      return SQLITE_OK    }    catchsql {DROP INDEX i1}  } {0 {}}  do_test auth-1.224 {    set ::authargs  } {i1 t1 temp {}}  do_test auth-1.225 {    execsql {SELECT name FROM sqlite_temp_master}  } {t1 i1}  do_test auth-1.226 {    proc auth {code arg1 arg2 arg3 arg4} {      if {$code=="SQLITE_DROP_TEMP_INDEX"} {        set ::authargs [list $arg1 $arg2 $arg3 $arg4]        return SQLITE_OK      }      return SQLITE_OK    }    catchsql {DROP INDEX i1}  } {0 {}}  do_test auth-1.227 {    set ::authargs  } {i1 t1 temp {}}  do_test auth-1.228 {    execsql {SELECT name FROM sqlite_temp_master}  } {t1}}do_test auth-1.229 {  proc auth {code arg1 arg2 arg3 arg4} {    if {$code=="SQLITE_PRAGMA"} {      set ::authargs [list $arg1 $arg2 $arg3 $arg4]      return SQLITE_DENY    }    return SQLITE_OK  }  catchsql {PRAGMA full_column_names=on}} {1 {not authorized}}do_test auth-1.230 {  set ::authargs} {full_column_names on {} {}}do_test auth-1.231 {  execsql2 {SELECT a FROM t2}} {a 11 a 7}do_test auth-1.232 {  proc auth {code arg1 arg2 arg3 arg4} {    if {$code=="SQLITE_PRAGMA"} {      set ::authargs [list $arg1 $arg2 $arg3 $arg4]      return SQLITE_IGNORE    }    return SQLITE_OK  }  catchsql {PRAGMA full_column_names=on}} {0 {}}do_test auth-1.233 {  set ::authargs} {full_column_names on {} {}}do_test auth-1.234 {  execsql2 {SELECT a FROM t2}} {a 11 a 7}do_test auth-1.235 {  proc auth {code arg1 arg2 arg3 arg4} {    if {$code=="SQLITE_PRAGMA"} {      set ::authargs [list $arg1 $arg2 $arg3 $arg4]      return SQLITE_OK    }    return SQLITE_OK  }  catchsql {PRAGMA full_column_names=on}} {0 {}}do_test auth-1.236 {  execsql2 {SELECT a FROM t2}} {t2.a 11 t2.a 7}do_test auth-1.237 {  proc auth {code arg1 arg2 arg3 arg4} {    if {$code=="SQLITE_PRAGMA"} {      set ::authargs [list $arg1 $arg2 $arg3 $arg4]      return SQLITE_OK    }    return SQLITE_OK  }  catchsql {PRAGMA full_column_names=OFF}} {0 {}}do_test auth-1.238 {  set ::authargs} {full_column_names OFF {} {}}do_test auth-1.239 {  execsql2 {SELECT a FROM t2}} {a 11 a 7}do_test auth-1.240 {  proc auth {code arg1 arg2 arg3 arg4} {    if {$code=="SQLITE_TRANSACTION"} {      set ::authargs [list $arg1 $arg2 $arg3 $arg4]      return SQLITE_DENY    }    return SQLITE_OK  }  catchsql {BEGIN}} {1 {not authorized}}do_test auth-1.241 {  set ::authargs} {BEGIN {} {} {}}do_test auth-1.242 {  proc auth {code arg1 arg2 arg3 arg4} {    if {$code=="SQLITE_TRANSACTION" && $arg1!="BEGIN"} {      set ::authargs [list $arg1 $arg2 $arg3 $arg4]      return SQLITE_DENY    }    return SQLITE_OK  }  catchsql {BEGIN; INSERT INTO t2 VALUES(44,55,66); COMMIT}} {1 {not authorized}}do_test auth-1.243 {  set ::authargs} {COMMIT {} {} {}}do_test auth-1.244 {  execsql {SELECT * FROM t2}} {11 2 33 7 8 9 44 55 66}do_test auth-1.245 {  catchsql {ROLLBACK}} {1 {not authorized}}do_test auth-1.246 {  set ::authargs} {ROLLBACK {} {} {}}do_test auth-1.247 {  catchsql {END TRANSACTION}} {1 {not authorized}}do_test auth-1.248 {  set ::authargs} {COMMIT {} {} {}}do_test auth-1.249 {  db authorizer {}  catchsql {ROLLBACK}} {0 {}}do_test auth-1.250 {  execsql {SELECT * FROM t2}} {11 2 33 7 8 9}# ticket #340 - authorization for ATTACH and DETACH.#do_test auth-1.251 {  db authorizer ::auth  proc auth {code arg1 arg2 arg3 arg4} {    if {$code=="SQLITE_ATTACH"} {      set ::authargs [list $arg1 $arg2 $arg3 $arg4]    }    return SQLITE_OK  }  catchsql {    ATTACH DATABASE ':memory:' AS test1  }} {0 {}}do_test auth-1.252 {  set ::authargs} {:memory: {} {} {}}do_test auth-1.253 {  catchsql {DETACH DATABASE test1}  proc auth {code arg1 arg2 arg3 arg4} {    if {$code=="SQLITE_ATTACH"} {      set ::authargs [list $arg1 $arg2 $arg3 $arg4]      return SQLITE_DENY    }    return SQLITE_OK  }  catchsql {    ATTACH DATABASE ':memory:' AS test1;  }} {1 {not authorized}}do_test auth-1.254 {  lindex [execsql {PRAGMA database_list}] 7} {}do_test auth-1.255 {  catchsql {DETACH DATABASE test1}  proc auth {code arg1 arg2 arg3 arg4} {    if {$code=="SQLITE_ATTACH"} {      set ::authargs [list $arg1 $arg2 $arg3 $arg4]      return SQLITE_IGNORE    }    return SQLITE_OK  }  catchsql {    ATTACH DATABASE ':memory:' AS test1;  }} {0 {}}do_test auth-1.256 {  lindex [execsql {PRAGMA database_list}] 7} {}do_test auth-1.257 {  proc auth {code arg1 arg2 arg3 arg4} {    if {$code=="SQLITE_DETACH"} {      set ::authargs [list $arg1 $arg2 $arg3 $arg4]      return SQLITE_OK    }    return SQLITE_OK  }  execsql {ATTACH DATABASE ':memory:' AS test1}  catchsql {    DETACH DATABASE test1;  }} {0 {}}do_test auth-1.258 {  lindex [execsql {PRAGMA database_list}] 7} {}do_test auth-1.259 {  execsql {ATTACH DATABASE ':memory:' AS test1}  proc auth {code arg1 arg2 arg3 arg4} {    if {$code=="SQLITE_DETACH"} {      set ::authargs [list $arg1 $arg2 $arg3 $arg4]      return SQLITE_IGNORE    }    return SQLITE_OK  }  catchsql {    DETACH DATABASE test1;  }} {0 {}}ifcapable tempdb {  ifcapable schema_pragmas {  do_test auth-1.260 {    lindex [execsql {PRAGMA database_list}] 7  } {test1}  } ;# ifcapable schema_pragmas  do_test auth-1.261 {    proc auth {code arg1 arg2 arg3 arg4} {      if {$code=="SQLITE_DETACH"} {        set ::authargs [list $arg1 $arg2 $arg3 $arg4]        return SQLITE_DENY      }      return SQLITE_OK    }    catchsql {      DETACH DATABASE test1;    }  } {1 {not authorized}}  ifcapable schema_pragmas {  do_test auth-1.262 {    lindex [execsql {PRAGMA database_list}] 7  } {test1}  } ;# ifcapable schema_pragmas  db authorizer {}  execsql {DETACH DATABASE test1}  db authorizer ::auth    # Authorization for ALTER TABLE. These tests are omitted if the library  # was built without ALTER TABLE support.  ifcapable altertable {      do_test auth-1.263 {      proc auth {code arg1 arg2 arg3 arg4} {        if {$code=="SQLITE_ALTER_TABLE"} {          set ::authargs [list $arg1 $arg2 $arg3 $arg4]          return SQLITE_OK        }        return SQLITE_OK      }      catchsql {        ALTER TABLE t1 RENAME TO t1x      }    } {0 {}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -