Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to previous message
wqcmaster is currently offline  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);
}

 
Read Message
Read Message
Read Message
Previous Topic: Application crashes when connected to MySQL, what am I doing wrong?
Next Topic: Commas into SQL
Goto Forum:
  


Current Time: Sun Apr 28 12:17:02 CEST 2024

Total time taken to generate the page: 0.06492 seconds