- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables
Class ::xo::db::oracle
::xo::db::oracle create ...
Class Relations
::xotcl::Class create ::xo::db::oracle \ -superclass ::xo::db::SQLMethods (to be applied on instances)
datatype_constraint (scripted)
set constraint "" switch -- $type { boolean { set cname [:mk_sql_constraint_name $table $att _ck] set constraint "constraint $cname check ($att in ('t','f'))"} } return $constraintdate_trunc (scripted)
return "to_char(trunc($date,'$field'), 'YYYY-MM-DD HH24:MI:SS')"date_trunc_expression (scripted)
if {![string match :* $date_string]} {set date_string "'$date_string'"} return "trunc($date,'$field') = trunc(to_date($date_string,'YYYY-MM-DD'),'$field')"limit_clause (scripted)
if {$limit ne "" || $offset ne ""} { if {$offset eq ""} { # # Only a limit is given. # set limit_clause "ROWNUM <= $limit" } elseif {$limit eq ""} { # # Only an offset is given. # set limit_clause "ROWNUM >= $offset" } else { # # Both, an offset and limit is given. # set limit_clause "ROWNUM BETWEEN $offset and [expr {$offset+$limit}]" } # for pagination, we will need an "inner" sort, such as # SELECT * FROM (SELECT ...., ROW_NUMBER() OVER (ORDER BY ...) R FROM table) WHERE R BETWEEN 0 and 100 set sql "SELECT * FROM ($sql) WHERE $limit_clause" } return $sqlmap_datatype (scripted)
switch -- $type { string { set type varchar2(1000) } text { set type varchar2(4000) } long_text { set type clob } boolean { set type char(1) } ltree { set type varchar2(1000) } default { return [next] } } return $typemap_function_name (scripted)
return [string map [list "__" .] $sql]mk_sql_constraint_name (scripted)
# # Constraint names are limited in oracle to 30 characters; # PostgreSQL has no such limits. Therefore, we use different # rules depending on whether we are running under Oracle or not. # set name ${table}_${att}_$suffix if {[string length $name] > 30} { set sl [string length $suffix] set name [string range ${table}_${att} 0 [expr {28 - $sl}]]_$suffix } return [string toupper $name]nextval (scripted)
return [xo::dc get_value nextval "select $sequence.nextval from dual"]select (scripted)
# "-start" not used so far set where_clause [expr {$where ne "" ? "WHERE $where" : ""}] set order_clause [expr {$orderby ne "" ? "ORDER BY $orderby" : ""}] set group_clause [expr {$groupby ne "" ? "GROUP BY $groupby" : ""}] set offset_clause [expr {$offset ne "" ? "OFFSET $offset ROWS" : ""}] set limit_clause [expr {$limit ne "" ? "FETCH NEXT $limit ROWS ONLY" : ""}] if {$map_function_names} {set vars [:map_function_name $vars]} set sql "SELECT $vars FROM $from $where_clause $group_clause $order_clause $offset_clause $limit_clause" #:log "--returned sql = $sql" return $sql
- Methods: All Methods Documented Methods Hide Methods
- Source: Display Source Hide Source
- Variables: Show Variables Hide Variables