| |
483 |
483 |
# Do the column check first to include only the tables we need |
| |
484 |
484 |
if {"$table.$column" in $columns} { |
| |
485 |
485 |
# We already have a column with the same name. Keep the |
| |
486 |
486 |
# first one as it's lower in the type hierarchy. |
| |
487 |
487 |
continue |
| |
488 |
488 |
} |
| |
489 |
489 |
# first time we're seeing this column |
| |
490 |
490 |
lappend columns "${table}.${column}" |
| |
491 |
491 |
|
| |
492 |
492 |
if {$table ni $tables} { |
| |
493 |
493 |
# First time we're seeing this table |
| |
494 |
494 |
lappend tables $table |
| |
495 |
495 |
lappend primary_keys "${table}.${object_column}" |
| |
496 |
496 |
} |
| |
497 |
497 |
} |
| |
498 |
498 |
|
| |
499 |
499 |
set pk_formatted [list] |
| |
500 |
500 |
for { set i 0 } { $i < [llength $primary_keys] - 1 } { incr i } { |
| |
501 |
501 |
lappend pk_formatted "[lindex $primary_keys $i] = [lindex $primary_keys $i+1]" |
| |
502 |
502 |
} |
| |
|
503 |
set where_clause "" |
| |
503 |
504 |
if {[llength $pk_formatted] > 0} { |
| |
504 |
505 |
set where_clause [join [string tolower $pk_formatted] "\n AND "] |
| |
505 |
506 |
set where_clause " WHERE $where_clause" |
| |
506 |
507 |
} |
| |
507 |
508 |
return "SELECT [string tolower [join $columns ",\n "]] |
| |
508 |
509 |
FROM [string tolower [join $tables ", "]] |
| |
509 |
510 |
$where_clause" |
| |
510 |
511 |
|
| |
511 |
512 |
} |
| |
512 |
513 |
|
| |
513 |
514 |
|
| |
514 |
515 |
|
| |
515 |
516 |
ad_proc -private package_insert_default_comment { } { |
| |
516 |
517 |
Returns a string to be used verbatim as the default comment we |
| |
517 |
518 |
insert into meta-generated packages and package bodies. If we have |
| |
518 |
519 |
a connection, we grab the user's name from ad_conn user_id. |
| |
519 |
520 |
|
| |
520 |
521 |
@author Michael Bryzek (mbryzek@arsdigita.com) |
| |
521 |
522 |
@creation-date 12/29/2000 |
| |
522 |
523 |
|