From 7876d562198368b36b5d40c3c31f8b7ae25d56b2 Mon Sep 17 00:00:00 2001 From: Vincent Mauge Date: Wed, 29 Oct 2014 18:36:37 -0700 Subject: [PATCH] Add support for long long int/BIGINT as a column type --- tools/gentable.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tools/gentable.py b/tools/gentable.py index 06c7acc2..8ddbe2dc 100755 --- a/tools/gentable.py +++ b/tools/gentable.py @@ -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(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 %}\ }