Home » U++ Library support » U++ SQL » PATCH/BUGFIX Oracle global temporary table
PATCH/BUGFIX Oracle global temporary table [message #45235] |
Wed, 14 October 2015 10:15  |
wqcmaster
Messages: 37 Registered: March 2013
|
Member |
|
|
Hi,
Oracle Definition for global temporary table: create global temporary table <tablename> on commit <...> as ( <select_cmd> );
PostgreSQL Definition for global temporary table: create [global] temporary table <tablename> on commit <...> as ( <select_cmd> );
so, it is not the great solution, but a simple sourcecode extension:
Sqlexp.h:
struct SqlCreateTable {
SqlId table;
bool permanent;
bool transaction;
enum { TRANSACTION, SESSION, PERMANENT };
public:
SqlCreateTable& Permanent() { permanent = true; return *this; }
SqlCreateTable& Transaction() { transaction = true; return *this; }
SqlStatement As(const SqlSelect& select);
SqlCreateTable(SqlId table) : table(table) { permanent = false; transaction = false; }
};
SqlStatement.cpp:
SqlStatement SqlCreateTable::As(const SqlSelect& select)
{
String text = "create ";
if(!permanent)
text << SqlCase(ORACLE | PGSQL, "global temporary ")("temporary ");
text << "table " << table.Quoted();
if(!permanent){
if (transaction)
text << SqlCase(ORACLE | PGSQL, " on commit delete rows")("");
else
text << SqlCase(ORACLE | PGSQL, " on commit preserve rows")("");
}
text << " as (" + SqlStatement(select).GetText() + ")";
return SqlStatement(text);
}
|
|
|
Goto Forum:
Current Time: Mon Apr 28 23:40:21 CEST 2025
Total time taken to generate the page: 0.00721 seconds
|