Lines Matching refs:statement
12 #include "app/sql/statement.h"
89 void VisitDatabase::FillVisitRow(sql::Statement& statement, VisitRow* visit) {
90 visit->visit_id = statement.ColumnInt64(0);
91 visit->url_id = statement.ColumnInt64(1);
92 visit->visit_time = base::Time::FromInternalValue(statement.ColumnInt64(2));
93 visit->referring_visit = statement.ColumnInt64(3);
94 visit->transition = PageTransition::FromInt(statement.ColumnInt(4));
95 visit->segment_id = statement.ColumnInt64(5);
96 visit->is_indexed = !!statement.ColumnInt(6);
100 void VisitDatabase::FillVisitVector(sql::Statement& statement,
102 while (statement.Step()) {
104 FillVisitRow(statement, &visit);
110 sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE,
114 if (!statement) {
115 VLOG(0) << "Failed to build visit insert statement: "
120 statement.BindInt64(0, visit->url_id);
121 statement.BindInt64(1, visit->visit_time.ToInternalValue());
122 statement.BindInt64(2, visit->referring_visit);
123 statement.BindInt64(3, visit->transition);
124 statement.BindInt64(4, visit->segment_id);
125 statement.BindInt64(5, visit->is_indexed);
127 if (!statement.Run()) {
128 VLOG(0) << "Failed to execute visit insert statement: "
137 sql::Statement statement1(GetDB().GetCachedStatement(SQL_FROM_HERE,
140 VLOG(0) << "Failed to build visit_source insert statement: "
148 VLOG(0) << "Failed to execute visit_source insert statement: "
160 sql::Statement update_chain(GetDB().GetCachedStatement(SQL_FROM_HERE,
169 sql::Statement del(GetDB().GetCachedStatement(SQL_FROM_HERE,
188 sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE,
190 if (!statement)
193 statement.BindInt64(0, visit_id);
194 if (!statement.Step())
197 FillVisitRow(statement, out_visit);
213 sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE,
217 if (!statement)
220 statement.BindInt64(0, visit.url_id);
221 statement.BindInt64(1, visit.visit_time.ToInternalValue());
222 statement.BindInt64(2, visit.referring_visit);
223 statement.BindInt64(3, visit.transition);
224 statement.BindInt64(4, visit.segment_id);
225 statement.BindInt64(5, visit.is_indexed);
226 statement.BindInt64(6, visit.visit_id);
227 return statement.Run();
233 sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE,
238 if (!statement)
241 statement.BindInt64(0, url_id);
242 FillVisitVector(statement, visits);
252 sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE,
256 if (!statement)
261 statement.BindInt64(0, begin_time.ToInternalValue());
262 statement.BindInt64(1, end ? end : std::numeric_limits<int64>::max());
263 statement.BindInt64(2,
266 FillVisitVector(statement, visits);
278 sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE,
283 if (!statement)
288 statement.BindInt64(0, begin_time.ToInternalValue());
289 statement.BindInt64(1, end ? end : std::numeric_limits<int64>::max());
290 statement.BindInt(2, PageTransition::CORE_MASK);
291 statement.BindInt(3, transition);
292 statement.BindInt64(4,
295 FillVisitVector(statement, visits);
305 sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE,
312 if (!statement)
316 // the same statement. Since the time has an index, this will be about the
319 statement.BindInt64(0, begin_time.ToInternalValue());
320 statement.BindInt64(1, end ? end : std::numeric_limits<int64>::max());
321 statement.BindInt(2, PageTransition::CHAIN_END);
322 statement.BindInt(3, PageTransition::CORE_MASK);
323 statement.BindInt(4, PageTransition::AUTO_SUBFRAME);
324 statement.BindInt(5, PageTransition::MANUAL_SUBFRAME);
325 statement.BindInt(6, PageTransition::KEYWORD_GENERATED);
328 while (statement.Step()) {
330 FillVisitRow(statement, &visit);
346 sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE,
351 if (!statement)
354 statement.BindInt64(0, url_id);
355 if (!statement.Step())
359 FillVisitRow(statement, visit_row);
362 return statement.ColumnInt64(0);
372 sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE,
378 if (!statement)
381 statement.BindInt64(0, url_id);
382 statement.BindInt(1, max_results);
383 FillVisitVector(statement, visits);
390 sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE,
395 if (!statement)
398 statement.BindInt64(0, from_visit);
399 statement.BindInt(1, PageTransition::IS_REDIRECT_MASK);
401 if (!statement.Step())
404 *to_visit = statement.ColumnInt64(0);
406 *to_url = GURL(statement.ColumnString(1));
421 sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE,
425 statement.BindInt64(0, row.referring_visit);
427 if (!statement.Step())
430 *from_url = GURL(statement.ColumnString(0));
457 sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE,
461 if (!statement)
464 statement.BindString(0, host_query_min);
465 statement.BindString(1, host_query_max);
467 if (!statement.Step()) {
473 *first_visit = base::Time::FromInternalValue(statement.ColumnInt64(0));
474 *count = statement.ColumnInt(1);
479 sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE,
481 if (!statement || !statement.Step() || statement.ColumnInt64(0) == 0) {
485 *first_visit = base::Time::FromInternalValue(statement.ColumnInt64(0));
504 // Compose the sql statement with a list of ids.
507 // Append all the ids in the statement.
514 sql::Statement statement(GetDB().GetUniqueStatement(sql.c_str()));
515 if (!statement)
519 while (statement.Step()) {
520 std::pair<VisitID, VisitSource> source_entry(statement.ColumnInt64(0),
521 static_cast<VisitSource>(statement.ColumnInt(1)));