Index: sql/connection.cc |
diff --git a/sql/connection.cc b/sql/connection.cc |
index ea3dacbb6ba025dc248590a40031cc4a508541f4..ee713c8e51e125fe02f25c904f80e7ffad3af09f 100644 |
--- a/sql/connection.cc |
+++ b/sql/connection.cc |
@@ -14,6 +14,7 @@ |
#include "sql/statement.h" |
#include "third_party/sqlite/sqlite3.h" |
Scott Hess - ex-Googler
2012/10/02 03:58:47
Egregious whitespace change is egregious.
|
+ |
namespace { |
// Spin for up to a second waiting for the lock to clear when setting |
@@ -455,6 +456,19 @@ bool Connection::DoesColumnExist(const char* table_name, |
return false; |
} |
+const std::string Connection::GetColumnType(const char* table_name, |
+ int column_index) const { |
+ std::string sql("PRAGMA TABLE_INFO ("); |
+ sql.append(table_name); |
+ sql.append(")"); |
+ |
+ Statement statement(GetUntrackedStatement(sql.c_str())); |
+ for(int i = 0; i <= column_index; i++) |
+ statement.Step(); |
+ |
+ return statement.ColumnString(2); |
+} |
+ |
int64 Connection::GetLastInsertRowId() const { |
if (!db_) { |
DLOG(FATAL) << "Illegal use of connection without a db"; |