Skip to content

Commit

Permalink
Add query for column_info in sqlite3 backend
Browse files Browse the repository at this point in the history
  • Loading branch information
Sildra committed Sep 21, 2023
1 parent 924d990 commit bf7ae24
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions include/soci/sqlite3/soci-sqlite3.h
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,21 @@ struct sqlite3_session_backend : details::session_backend
return "select name as \"TABLE_NAME\""
" from sqlite_master where type = 'table'";
}
std::string get_column_description_query()
{
return "select name as 'COLUMN_NAME',"
" 0 as 'CHARACTER_MAXIMUM_LENGTH',"
" 0 as 'NUMERIC_PRECISION',"
" case when type like '%real%' or type like '%float%' or type like '%double%' then 255 else 0 end as 'NUMERIC_SCALE',"
" case"
" when type like 'text' or type like 'clob' or type like '%char%' then 'text'"
" when type like '%int%' or type like '%number%' or type like '%numeric%' then 'integer'"
" when type like '%real%' or type like '%float%' or type like '%double%' then 'number'"
" else type"
" end as 'DATA_TYPE',"
" case when \"notnull\" = 0 then 'YES' else 'NO' end as 'IS_NULLABLE'"
" from (select name, lower(type) as type, \"notnull\" from pragma_table_info(:t))";
}
std::string create_column_type(data_type dt,
int , int ) override
{
Expand Down

0 comments on commit bf7ae24

Please sign in to comment.