OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2013 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 else | 138 else |
139 m_error = SQLErrorData::create(SQLError::SYNTAX_ERR, "could not prep
are statement", result, database->lastErrorMsg()); | 139 m_error = SQLErrorData::create(SQLError::SYNTAX_ERR, "could not prep
are statement", result, database->lastErrorMsg()); |
140 db->reportExecuteStatementResult(1, m_error->code(), result); | 140 db->reportExecuteStatementResult(1, m_error->code(), result); |
141 return false; | 141 return false; |
142 } | 142 } |
143 | 143 |
144 // FIXME: If the statement uses the ?### syntax supported by sqlite, the bin
d parameter count is very likely off from the number of question marks. | 144 // FIXME: If the statement uses the ?### syntax supported by sqlite, the bin
d parameter count is very likely off from the number of question marks. |
145 // If this is the case, they might be trying to do something fishy or malici
ous | 145 // If this is the case, they might be trying to do something fishy or malici
ous |
146 if (statement.bindParameterCount() != m_arguments.size()) { | 146 if (statement.bindParameterCount() != m_arguments.size()) { |
147 WTF_LOG(StorageAPI, "Bind parameter count doesn't match number of questi
on marks"); | 147 WTF_LOG(StorageAPI, "Bind parameter count doesn't match number of questi
on marks"); |
148 m_error = SQLErrorData::create(db->isInterrupted() ? SQLError::DATABASE_
ERR : SQLError::SYNTAX_ERR, "number of '?'s in statement string does not match a
rgument count"); | 148 m_error = SQLErrorData::create(SQLError::SYNTAX_ERR, "number of '?'s in
statement string does not match argument count"); |
149 db->reportExecuteStatementResult(2, m_error->code(), 0); | 149 db->reportExecuteStatementResult(2, m_error->code(), 0); |
150 return false; | 150 return false; |
151 } | 151 } |
152 | 152 |
153 for (unsigned i = 0; i < m_arguments.size(); ++i) { | 153 for (unsigned i = 0; i < m_arguments.size(); ++i) { |
154 result = statement.bindValue(i + 1, m_arguments[i]); | 154 result = statement.bindValue(i + 1, m_arguments[i]); |
155 if (result == SQLResultFull) { | 155 if (result == SQLResultFull) { |
156 setFailureDueToQuota(db); | 156 setFailureDueToQuota(db); |
157 return false; | 157 return false; |
158 } | 158 } |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 if (lastExecutionFailedDueToQuota()) | 232 if (lastExecutionFailedDueToQuota()) |
233 m_error = nullptr; | 233 m_error = nullptr; |
234 } | 234 } |
235 | 235 |
236 bool SQLStatementBackend::lastExecutionFailedDueToQuota() const | 236 bool SQLStatementBackend::lastExecutionFailedDueToQuota() const |
237 { | 237 { |
238 return m_error && m_error->code() == SQLError::QUOTA_ERR; | 238 return m_error && m_error->code() == SQLError::QUOTA_ERR; |
239 } | 239 } |
240 | 240 |
241 } // namespace blink | 241 } // namespace blink |
OLD | NEW |