OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 ASSERT(m_result.size() % m_columns.size() == 0); | 42 ASSERT(m_result.size() % m_columns.size() == 0); |
43 | 43 |
44 return m_result.size() / m_columns.size(); | 44 return m_result.size() / m_columns.size(); |
45 } | 45 } |
46 | 46 |
47 ScriptValue SQLResultSetRowList::item(ScriptState* scriptState, | 47 ScriptValue SQLResultSetRowList::item(ScriptState* scriptState, |
48 unsigned index, | 48 unsigned index, |
49 ExceptionState& exceptionState) { | 49 ExceptionState& exceptionState) { |
50 if (index >= length()) { | 50 if (index >= length()) { |
51 exceptionState.throwDOMException( | 51 exceptionState.throwDOMException( |
52 IndexSizeError, ExceptionMessages::indexExceedsMaximumBound<unsigned>( | 52 IndexSizeError, |
53 "index", index, length())); | 53 ExceptionMessages::indexExceedsMaximumBound<unsigned>("index", index, |
| 54 length())); |
54 return ScriptValue(); | 55 return ScriptValue(); |
55 } | 56 } |
56 | 57 |
57 unsigned numColumns = m_columns.size(); | 58 unsigned numColumns = m_columns.size(); |
58 unsigned valuesIndex = index * numColumns; | 59 unsigned valuesIndex = index * numColumns; |
59 | 60 |
60 Vector<std::pair<String, SQLValue>> dataArray; | 61 Vector<std::pair<String, SQLValue>> dataArray; |
61 for (unsigned i = 0; i < numColumns; ++i) | 62 for (unsigned i = 0; i < numColumns; ++i) |
62 dataArray.push_back( | 63 dataArray.push_back( |
63 std::make_pair(m_columns[i], m_result[valuesIndex + i])); | 64 std::make_pair(m_columns[i], m_result[valuesIndex + i])); |
64 | 65 |
65 return ScriptValue::from(scriptState, dataArray); | 66 return ScriptValue::from(scriptState, dataArray); |
66 } | 67 } |
67 | 68 |
68 } // namespace blink | 69 } // namespace blink |
OLD | NEW |