Skip to content
This repository has been archived by the owner on Feb 9, 2025. It is now read-only.

Commit

Permalink
Using LAMPADAS_DB_USER from setenv.sh (instead of local DB_USER)
Browse files Browse the repository at this point in the history
Directory LAMPADAS_SPOOL is created if it does not exist.
  • Loading branch information
alba committed Oct 27, 2002
1 parent f9bd4e7 commit c16a5db
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions bin/lampadasdb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/sh

SCRIPT_NAME=lampadasdb
DB_USER=lampadas

usage()
{
Expand Down Expand Up @@ -206,7 +205,7 @@ m4script()
psqlcmd()
{
# the record separator is a tabstop + a newline + a tabstop
psql -U $DB_USER -q -A -F '], [' -P tuples_only -R "
psql -U $LAMPADAS_DB_USER -q -A -F '], [' -P tuples_only -R "
" -v I18N_lang_code=\'$1\' $LAMPADAS_DB \
< "$2" \
| "$LAMPADAS_SQL/common.export"
Expand Down Expand Up @@ -252,7 +251,7 @@ ExportM4()
ExportOne "$sqlcmd" EN > "$dst_dir/EN.m4"
else
# we know the field name, now select all available languages
psql -U $DB_USER -q -A -P tuples_only \
psql -U $LAMPADAS_DB_USER -q -A -P tuples_only \
-c "SELECT DISTINCT $field FROM $table;" \
$LAMPADAS_DB \
| while read lang
Expand Down Expand Up @@ -304,6 +303,8 @@ check_var "$LAMPADAS_SPOOL" "LAMPADAS_SPOOL" "spool"
check_var "$LAMPADAS_SQL" "LAMPADAS_SQL" "sql"
check_var "$LAMPADAS_WWW_USER" "LAMPADAS_WWW_USER"

[ -d $LAMPADAS_SPOOL ] || mkdir $LAMPADAS_SPOOL

TABLE_ORDER="$LAMPADAS_SPOOL/table_order.mak"
need_rebuild "$TABLE_ORDER" && build_makefile

Expand All @@ -320,4 +321,4 @@ if need_rebuild "$sql"; then
) > $sql || exit -1
fi
echo "Executing $sql" \
&& psql -U $DB_USER $LAMPADAS_DB -qf "$sql"
&& psql -U $LAMPADAS_DB_USER $LAMPADAS_DB -qf "$sql"

0 comments on commit c16a5db

Please sign in to comment.