Add support for long long int/BIGINT as a column type

This commit is contained in:
Vincent Mauge 2014-10-29 18:36:37 -07:00
parent eef4d31a93
commit 7876d56219

View File

@ -61,6 +61,7 @@ const std::string
"{{col.name}} \
{% if col.type == "std::string" %}VARCHAR{% endif %}\
{% if col.type == "int" %}INTEGER{% endif %}\
{% if col.type == "long long int" %}BIGINT{% endif %}\
{% if not loop.last %}, {% endif %}"
{% endfor %}\
")";
@ -109,6 +110,12 @@ int {{table_name_cc}}Column(
ctx,
(int)pVtab->pContent->{{col.name}}[pCur->row]
);
{% endif %}\
{% if col.type == "long long int" %}\
sqlite3_result_int64(
ctx,
(long long int)pVtab->pContent->{{col.name}}[pCur->row]
);
{% endif %}\
break;
{% endfor %}\
@ -151,6 +158,15 @@ int {{table_name_cc}}Filter(
pVtab->pContent->{{col.name}}.push_back(-1);
}
{% endif %}\
{% if col.type == "long long int" %}\
try {
pVtab->pContent->{{col.name}}\
.push_back(boost::lexical_cast<long long>(row["{{col.name}}"]));
} catch (const boost::bad_lexical_cast& e) {
LOG(WARNING) << "Error casting " << row["{{col.name}}"] << " to long long int";
pVtab->pContent->{{col.name}}.push_back(-1);
}
{% endif %}\
{% endfor %}\
}