fix: value→TEXT, cfoutput wrapper, cf_sql_varchar
This commit is contained in:
+1
-1
@@ -23,7 +23,7 @@
|
|||||||
<cfquery>
|
<cfquery>
|
||||||
CREATE TABLE IF NOT EXISTS #request.tableName# (
|
CREATE TABLE IF NOT EXISTS #request.tableName# (
|
||||||
id SERIAL PRIMARY KEY,
|
id SERIAL PRIMARY KEY,
|
||||||
value INTEGER NOT NULL
|
value TEXT NOT NULL DEFAULT ''
|
||||||
)
|
)
|
||||||
</cfquery>
|
</cfquery>
|
||||||
<cfcatch type="database"></cfcatch>
|
<cfcatch type="database"></cfcatch>
|
||||||
|
|||||||
@@ -6,22 +6,22 @@
|
|||||||
<cfif FORM.action EQ "create">
|
<cfif FORM.action EQ "create">
|
||||||
<cfquery name="insertRow">
|
<cfquery name="insertRow">
|
||||||
INSERT INTO #tableName# (value)
|
INSERT INTO #tableName# (value)
|
||||||
VALUES (<cfqueryparam value="#FORM.value#" cfsqltype="cf_sql_integer" />)
|
VALUES (<cfqueryparam value="#FORM.value#" cfsqltype="cf_sql_varchar" />)
|
||||||
</cfquery>
|
</cfquery>
|
||||||
</cfif>
|
</cfif>
|
||||||
|
|
||||||
<cfif FORM.action EQ "update">
|
<cfif FORM.action EQ "update">
|
||||||
<cfquery name="updateRow">
|
<cfquery name="updateRow">
|
||||||
UPDATE #tableName#
|
UPDATE #tableName#
|
||||||
SET value = <cfqueryparam value="#FORM.value#" cfsqltype="cf_sql_integer" />
|
SET value = <cfqueryparam value="#FORM.value#" cfsqltype="cf_sql_varchar" />
|
||||||
WHERE id = <cfqueryparam value="#FORM.id#" cfsqltype="cf_sql_integer" />
|
WHERE id = <cfqueryparam value="#FORM.id#" cfsqltype="cf_sql_varchar" />
|
||||||
</cfquery>
|
</cfquery>
|
||||||
</cfif>
|
</cfif>
|
||||||
|
|
||||||
<cfif FORM.action EQ "delete">
|
<cfif FORM.action EQ "delete">
|
||||||
<cfquery name="deleteRow">
|
<cfquery name="deleteRow">
|
||||||
DELETE FROM #tableName#
|
DELETE FROM #tableName#
|
||||||
WHERE id = <cfqueryparam value="#FORM.id#" cfsqltype="cf_sql_integer" />
|
WHERE id = <cfqueryparam value="#FORM.id#" cfsqltype="cf_sql_varchar" />
|
||||||
</cfquery>
|
</cfquery>
|
||||||
</cfif>
|
</cfif>
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
<cfif isDefined("URL.edit")>
|
<cfif isDefined("URL.edit")>
|
||||||
<cfquery name="editQuery">
|
<cfquery name="editQuery">
|
||||||
SELECT id, value FROM #tableName#
|
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>
|
</cfquery>
|
||||||
<cfif editQuery.recordCount GT 0>
|
<cfif editQuery.recordCount GT 0>
|
||||||
<cfset editRow = { id = editQuery.id, value = editQuery.value } />
|
<cfset editRow = { id = editQuery.id, value = editQuery.value } />
|
||||||
@@ -89,7 +89,7 @@
|
|||||||
</cfif>
|
</cfif>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<cfif NOT structIsEmpty(editRow)>
|
<cfif NOT structIsEmpty(editRow)><cfoutput>
|
||||||
<h2>Редактировать #editRow.id#</h2>
|
<h2>Редактировать #editRow.id#</h2>
|
||||||
<form method="post">
|
<form method="post">
|
||||||
<input type="hidden" name="action" value="update" />
|
<input type="hidden" name="action" value="update" />
|
||||||
@@ -97,7 +97,7 @@
|
|||||||
<input type="number" name="value" value="#editRow.value#" required />
|
<input type="number" name="value" value="#editRow.value#" required />
|
||||||
<button type="submit">Сохранить</button>
|
<button type="submit">Сохранить</button>
|
||||||
<a href="index.cfm">Отмена</a>
|
<a href="index.cfm">Отмена</a>
|
||||||
</form>
|
</form></cfoutput>
|
||||||
<cfelse>
|
<cfelse>
|
||||||
<h2>Добавить</h2>
|
<h2>Добавить</h2>
|
||||||
<form method="post">
|
<form method="post">
|
||||||
|
|||||||
Reference in New Issue
Block a user