CMS/프레임워크 | XE 1.x |
---|---|
개발 언어 | PHP 5.x |
모듈을 처음 만들어 보는데요
쿼리를 넣을 string을 디버그 해보면 DEBUG : string('./files/attach/images/65/004/1c645b1360eea53ca0d7e4da318db184.jpg')
로 정상적으로 나오는데
위에 쿼리를 실행하면
[error] => 1064
[message] => You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '/`files`/`attach`/`images`/65/004/`1c645b1360eea53ca0d7e4da318db184`.`jpg`)' at line 3
[variables] => Array
(
[_query] => INSERT INTO `xe_sgame_files`
(`member_srl`, `file_srl`, `file_name`, `url`)
VALUES (4, 179, `1522faccf9f52fe078a7df939741e54a`.`jpg`, ./`files`/`attach`/`images`/65/004/`1c645b1360eea53ca0d7e4da318db184`.`jpg`)
[_elapsed_time] => 0.00021
)
이런 오류가 나옵니다.
어떻게 해결하는건지 모르겠네요.. 도와주세요
댓글 9
DEBUG : string('./files/attach/images/65/004/1c645b1360eea53ca0d7e4da318db184.jpg')
으로 원하는게 나오는것 같은데
executequery를 실행하고 output에선
./`files`/`attach`/`images`/65/004/`1c645b1360eea53ca0d7e4da318db184`.`jpg`
처럼 알수없는 따옴표들이 추가되는것 같은데 왜 이러하게 변형되는지 모르겠습니다...
이거 붙이신 이유가?
args:
DEBUG : stdClass Object
(
[member_srl] => 4
[file_srl] => 180
[file_name] => 21454E3A582A731B15.png
[url] => ./files/attach/images/65/004/65ac4cbdb72e8e5929698a7d833fb5ea.png
[regdate] =>
)
output:
DEBUG : BaseObject Object
(
[error] => 1064
[message] => You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '/`files`/`attach`/`images`/65/004/`65ac4cbdb72e8e5929698a7d833fb5ea`.`png`)' at line 3
[variables] => Array
(
[_query] => INSERT INTO `xe_sgame_files`
(`member_srl`, `file_srl`, `file_name`, `url`)
VALUES (4, 180, `21454E3A582A731B15`.`png`, ./`files`/`attach`/`images`/65/004/`65ac4cbdb72e8e5929698a7d833fb5ea`.`png`)
[_elapsed_time] => 0.00202
)
[httpStatusCode] =>
)
$oDB->use_prepared_statements = 'N'; 은 안하면 디버그 output에서 values 값들이 (?, ?, ?, ?) 로 표시되길래 넣었습니다
insertSImageToDB 파일이고요:
<query id="insertSImageToDB" action="insert">
<tables>
<table name="s_files" />
</tables>
<columns>
<column name="member_srl" var="member_srl" />
<column name="file_srl" var="file_srl" />
<column name="file_name" var="file_name" />
<column name="url" var="url" />
<column name="regdate" var="regdate" />
</columns>
</query>
스키마 파일 입니다:
<table name="s_files">
<column name="member_srl" type="number" size="11" notnull="notnull" primary_key="primary_key"/>
<column name="file_srl" type="number" size="11" notnull="notnull" />
<column name="file_name" type="varchar" size="120" />
<column name="url" type="varchar" size="120" notnull="notnull" />
<column name="regdate" notnull="notnull" type="date" index="idx_regdate" />
</table>
primary_key="primary_key"/>에서 /> 앞에 띄어쓰기가 누락된 것 외에는 스키마와 쿼리 모두 특별한 문제는 없어 보입니다. 만약 띄어쓰기가 의심된다면 그 부분 수정해 보시고요...
혹시 한글이나 영어가 아닌 다른 언어를 기본으로 사용하거나, UTF-8이 아닌 서버 환경에서 운영하고 계신가요? 저런 식으로 escape 처리가 잘못 되는 경우는 서버 환경이 XE와 맞지 않아서 그럴 수도 있거든요.
답변해주신분들 정말 감사합니다!