summary refs log tree commit diff stats
path: root/tests/reject/tnotnil2.nim
blob: bd6b8b67550ff6cc1503f88890d3995a6e3abfd6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
discard """
  errormsg: "cannot prove 'y' is not nil"
  line:20
"""

import strutils


type
  TObj = object
    x, y: int

proc q(x: pointer not nil) =
  nil

proc p() =
  var x: pointer
  let y = x
  if not y.isNil or y != x:
    q(y)
  else:
    q(y)

p()
lass="p">); if (!($dbh = mysqli_connect('localhost', 'root', ''))) display_failure('Could not connect to the database: ' . mysqli_connect_error($dbh)); mysqli_set_charset($dbh, 'utf8mb4'); if (!mysqli_query($dbh, 'CREATE DATABASE IF NOT EXISTS STUDENTS_DB')) display_failure('Could not create database: ' . mysqli_error($dbh)); mysqli_select_db($dbh, 'STUDENTS_DB'); if (!mysqli_query($dbh, 'CREATE TABLE IF NOT EXISTS STUDENT ( ROLL INT(20) PRIMARY KEY, NAME VARCHAR(255), CITY VARCHAR(255), EMAIL VARCHAR(255), DATE_OF_BIRTH DATE )')) display_failure('Could not create table: ' . mysqli_error($dbh)); return $dbh; } function html_prologue($title) { ?><!doctype html> <meta charset="utf-8"> <title><?php echo $title; ?></title> <style> body { font-family: sans-serif; font-size: 1.3rem; } h1 { font-size: 2rem; font-weight: 500; } h2 { font-size: 1.8rem; font-weight: 500; } form { margin: 2em auto; width: 20em; } form > * { padding: 0.5em; } table, tr, th, td { border-collapse: collapse; border: 1px solid black; } th, td { padding: 5px; } </style> <?php } function display_search_form() { html_prologue('Student details'); ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>"> <h2>Enter E-mail address to search for the record of a student</h2> <label>E-mail: <input type="email" name="email"></label> <input type="submit" value="Search"> </form> <?php } function display_failure($reason) { html_prologue('Operation failure'); ?> <h2>Operation failed</h2> <p>Reason: <?php echo $reason; ?></p> <?php die(); } function search_and_show($dbh, $email) { $stmt = mysqli_prepare($dbh, 'SELECT * FROM STUDENT WHERE EMAIL = ?'); $result = mysqli_query($dbh, ); html_prologue('Students\' details'); ?> <h2>Students' details</h2> <p><?php echo mysqli_num_rows($result); ?> record(s) found.</p> <table> <tr> <th>Roll No.</th> <th>Name</th> <th>E-mail</th> <th>City</th> <th>Date of birth</th> </tr><?php while ($row = mysqli_fetch_assoc($result)) { ?> <tr><td> <?php echo implode('</td><td>', array_map('htmlspecialchars', [ $row['ROLL'], $row['NAME'], $row['EMAIL'], $row['CITY'], $row['DATE_OF_BIRTH'] ])); ?> </td></tr> <?php } ?> </table> <?php } if (isset($_GET['email']) && !empty($_GET['email'])) { $dbh = connect_to_database(); search_and_show($dbh, $_GET['email']); mysqli_close($dbh); } else { html_prologue('Search for a student'); display_search_form(); }