Skip to content

Commit

Permalink
Forward create_column_type() to db_type overload
Browse files Browse the repository at this point in the history
  • Loading branch information
zann1x committed Oct 18, 2023
1 parent 037a332 commit 06b68c2
Showing 1 changed file with 9 additions and 32 deletions.
41 changes: 9 additions & 32 deletions include/soci/soci-backend.h
Original file line number Diff line number Diff line change
Expand Up @@ -357,58 +357,35 @@ class session_backend
switch (dt)
{
case dt_string:
{
std::ostringstream oss;

if (precision == 0)
{
oss << "text";
}
else
{
oss << "varchar(" << precision << ")";
}

res += oss.str();
}
res += create_column_type(db_string, precision, scale);
break;

case dt_date:
res += "timestamp";
res += create_column_type(db_date, precision, scale);
break;

case dt_double:
{
std::ostringstream oss;
if (precision == 0)
{
oss << "numeric";
}
else
{
oss << "numeric(" << precision << ", " << scale << ")";
}

res += oss.str();
}
res += create_column_type(db_double, precision, scale);
break;

case dt_integer:
res += "integer";
res += create_column_type(db_int32, precision, scale);
break;

case dt_long_long:
res += "bigint";
res += create_column_type(db_int64, precision, scale);
break;

case dt_unsigned_long_long:
res += create_column_type(db_uint64, precision, scale);
break;

case dt_blob:
res += "oid";
res += create_column_type(db_blob, precision, scale);
break;

case dt_xml:
res += "xml";
res += create_column_type(db_xml, precision, scale);
break;

default:
Expand Down

0 comments on commit 06b68c2

Please sign in to comment.