fix: value→TEXT, cfoutput wrapper, cf_sql_varchar

This commit is contained in:
2026-07-19 19:00:35 +04:00
parent 94ebf06890
commit 1dccaef040
2 changed files with 8 additions and 8 deletions
+1 -1
View File
@@ -23,7 +23,7 @@
<cfquery>
CREATE TABLE IF NOT EXISTS #request.tableName# (
id SERIAL PRIMARY KEY,
value INTEGER NOT NULL
value TEXT NOT NULL DEFAULT ''
)
</cfquery>
<cfcatch type="database"></cfcatch>
+7 -7
View File
@@ -6,22 +6,22 @@
<cfif FORM.action EQ "create">
<cfquery name="insertRow">
INSERT INTO #tableName# (value)
VALUES (<cfqueryparam value="#FORM.value#" cfsqltype="cf_sql_integer" />)
VALUES (<cfqueryparam value="#FORM.value#" cfsqltype="cf_sql_varchar" />)
</cfquery>
</cfif>
<cfif FORM.action EQ "update">
<cfquery name="updateRow">
UPDATE #tableName#
SET value = <cfqueryparam value="#FORM.value#" cfsqltype="cf_sql_integer" />
WHERE id = <cfqueryparam value="#FORM.id#" cfsqltype="cf_sql_integer" />
SET value = <cfqueryparam value="#FORM.value#" cfsqltype="cf_sql_varchar" />
WHERE id = <cfqueryparam value="#FORM.id#" cfsqltype="cf_sql_varchar" />
</cfquery>
</cfif>
<cfif FORM.action EQ "delete">
<cfquery name="deleteRow">
DELETE FROM #tableName#
WHERE id = <cfqueryparam value="#FORM.id#" cfsqltype="cf_sql_integer" />
WHERE id = <cfqueryparam value="#FORM.id#" cfsqltype="cf_sql_varchar" />
</cfquery>
</cfif>
@@ -33,7 +33,7 @@
<cfif isDefined("URL.edit")>
<cfquery name="editQuery">
SELECT id, value FROM #tableName#
WHERE id = <cfqueryparam value="#URL.edit#" cfsqltype="cf_sql_integer" />
WHERE id = <cfqueryparam value="#URL.edit#" cfsqltype="cf_sql_varchar" />
</cfquery>
<cfif editQuery.recordCount GT 0>
<cfset editRow = { id = editQuery.id, value = editQuery.value } />
@@ -89,7 +89,7 @@
</cfif>
</table>
<cfif NOT structIsEmpty(editRow)>
<cfif NOT structIsEmpty(editRow)><cfoutput>
<h2>Редактировать #editRow.id#</h2>
<form method="post">
<input type="hidden" name="action" value="update" />
@@ -97,7 +97,7 @@
<input type="number" name="value" value="#editRow.value#" required />
<button type="submit">Сохранить</button>
<a href="index.cfm">Отмена</a>
</form>
</form></cfoutput>
<cfelse>
<h2>Добавить</h2>
<form method="post">