-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLoadDataFromSQLBackup.php
76 lines (64 loc) · 1.32 KB
/
LoadDataFromSQLBackup.php
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
<?php
try
{
$conn = new PDO("sqlsrv:Server=DESKTOP-BLQ3M1P\SQLEXPRESS;Database=Limburg");
$conn->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch(Exception $e)
{
die (print_r($e->getMessage()));
}
if($_POST["tile"]) {
$tilename = $_POST["tile"];
} else {
echo "No POST tile received";
}
if($_POST["size"]) {
$size = $_POST["size"];
} else {
echo "No POST tile size received";
}
$tsql = "SELECT t.[height]
FROM
(
SELECT height, ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) AS rownum
FROM [Limburg].[dbo].[".$tilename."]
) AS t
WHERE
(
(t.rownum % 4 = 0)
OR
(t.rownum = 0)
OR
(t.rownum = 4198401)
)";
$getResults = $conn->prepare($tsql);
$getResults->execute();
$results = $getResults->fetchAll(PDO::FETCH_BOTH);
foreach($results as $row) {
echo $row['height'];
echo ",";
}
$mb = memory_get_usage() / 1048576;
?>
SELECT t.[height]
FROM
(
SELECT height, ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) AS rownum
FROM [Limburg].[dbo].[".$tilename."]
) AS t
WHERE t.rownum % 4 = 0
SELECT t.[height]
FROM
(
SELECT height, ROW_NUMBER() OVER (ORDER BY (SELECT NULL)) AS rownum
FROM [Limburg].[dbo].".$tilename."]
) AS t
WHERE
(
(t.rownum % 4 = 0)
OR
(t.rownum = 0)
OR
(t.rownum = 4198401)
)