testlucee/query.cfm
2026-02-15 09:13:43 +03:00

66 lines
2.1 KiB
Plaintext

<h1>TEST v2</h1>
<style>
body { font-family: sans-serif; margin: 30px; line-height: 1.5; }
table { border-collapse: collapse; width: 80%; margin-top: 20px; }
th, td { border: 1px solid #ccc; padding: 10px; text-align: left; }
th { background: #eee; }
.success { color: #27ae60; font-weight: bold; }
.env-box { background: #f9f9f9; padding: 10px; border: 1px dashed #999; margin-top: 30px; font-size: 0.8em; }
</style>
<h2>🛠 Тест базы данных: Запись и Чтение</h2>
<cftry>
<cfquery name="qCreate">
CREATE TABLE IF NOT EXISTS nubes_test_table (
id SERIAL PRIMARY KEY,
test_data TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
</cfquery>
<cfquery name="qInsert">
INSERT INTO nubes_test_table (test_data)
VALUES ('Проверка записи через Lucee: ' || CURRENT_TIMESTAMP);
</cfquery>
<cfquery name="qSelect">
SELECT * FROM nubes_test_table ORDER BY id DESC LIMIT 10;
</cfquery>
<p class="success">✅ Соединение активно! Данные успешно записаны в PostgreSQL.</p>
<table>
<thead>
<tr>
<th>ID</th>
<th>Сообщение из базы</th>
<th>Дата и время в БД</th>
</tr>
</thead>
<tbody>
<cfoutput query="qSelect">
<tr>
<td>#id#</td>
<td>#test_data#</td>
<td>#created_at#</td>
</tr>
</cfoutput>
</tbody>
</table>
<cfcatch>
<div style="color:red; border: 1px solid red; padding: 10px;">
<strong>❌ Ошибка:</strong><br>
<cfoutput>#cfcatch.message#</cfoutput>
</div>
</cfcatch>
</cftry>
<div class="env-box">
<details>
<summary style="cursor:pointer;">Показать переменные окружения (Terraform)</summary>
<cfdump var="#createObject('java', 'java.lang.System').getEnv()#" label="System Env" expand="false">
</details>
</div>