예약어 처리용 쿼리 작성

This commit is contained in:
김민서 2024-02-28 09:54:40 +09:00
parent 5a5918950a
commit 2956e1deca
1 changed files with 10 additions and 10 deletions

View File

@ -56,7 +56,7 @@ namespace Server.Git
if (sheets[n].type[m] == "long" && sheets[n].variable[m] == "index") if (sheets[n].type[m] == "long" && sheets[n].variable[m] == "index")
{ {
newTableQuery.Append("index SERIAL PRIMARY KEY"); newTableQuery.Append("\"index\" SERIAL PRIMARY KEY");
tableDatas.Append("index"); tableDatas.Append("index");
continue; continue;
} }
@ -68,35 +68,35 @@ namespace Server.Git
switch (sheets[n].type[m]) switch (sheets[n].type[m])
{ {
case "bool": case "bool":
newTableQuery.Append($"{sheets[n].variable[m]} BOOL "); newTableQuery.Append($"\"{sheets[n].variable[m]}\" BOOL ");
break; break;
case "int": case "int":
newTableQuery.Append($"{sheets[n].variable[m]} INT "); newTableQuery.Append($"\"{sheets[n].variable[m]}\" INT ");
break; break;
case "long": case "long":
newTableQuery.Append($"{sheets[n].variable[m]} INT8 "); newTableQuery.Append($"\"{sheets[n].variable[m]}\" INT8 ");
break; break;
case "float": case "float":
newTableQuery.Append($"{sheets[n].variable[m]} FLOAT4 "); newTableQuery.Append($"\"{sheets[n].variable[m]}\" FLOAT4 ");
break; break;
case "string": case "string":
case "json": case "json":
newTableQuery.Append($"{sheets[n].variable[m]} VARCHAR(255) "); newTableQuery.Append($"\"{sheets[n].variable[m]}\" VARCHAR(255) ");
break; break;
case "enum": case "enum":
newTableQuery.Append($"{sheets[n].variable[m]} INT2 ") ; newTableQuery.Append($"\"{sheets[n].variable[m]}\" INT2 ") ;
break; break;
case "text": case "text":
newTableQuery.Append($"{sheets[n].variable[m]} TEXT "); newTableQuery.Append($"\"{sheets[n].variable[m]}\" TEXT ");
break; break;
case "time": case "time":
newTableQuery.Append($"{sheets[n].variable[m]} timestamp "); newTableQuery.Append($"\"{sheets[n].variable[m]}\" timestamp ");
break; break;
default: default:
logger.Error($"unknown data {sheets[n].type[m]}"); logger.Error($"unknown data {sheets[n].type[m]}");
break; break;
} }
tableDatas.Append(sheets[n].variable[m]); tableDatas.Append($"\"{sheets[n].variable[m]}\"");
} }
newTableQuery.Append(");\n"); newTableQuery.Append(");\n");
tableDatas.Append(") VALUES "); tableDatas.Append(") VALUES ");