3 # control tool for maintaining Kamailio
5 #===================================================================
7 ##### ----------------------------------------------- #####
8 ### PGSQL specific variables and functions
11 ##### ----------------------------------------------- #####
14 if [ -f "$MYLIBDIR/kamctl.sqlbase" ]; then
15 . "$MYLIBDIR/kamctl.sqlbase"
17 echo "Cannot load SQL core functions '$MYLIBDIR/kamctl.sqlbase' - exiting ..."
21 ##### ----------------------------------------------- #####
23 if [ -z "$PGSQL" ] ; then
25 if [ -z "$TOOLPATH" ] ; then
26 echo "error: 'psql' tool not found: set PGSQL variable to correct tool path"
33 # input: sql query, optional pgsql command-line params
35 # if password not yet queried, query it now
36 prompt_pw "PgSQL password for user '$DBRWUSER@$DBHOST'"
37 mecho "pgsql_query: $PGSQL $2 -A -q -t -P fieldsep=' ' -h $DBHOST -U $DBRWUSER $DBNAME -c '$1'"
38 PGPASSWORD="$DBRWPW" $PGSQL $2 \
47 # input: sql query, optional pgsql command-line params
49 mdbg "pgsql_ro_query: $PGSQL $2 -h $DBHOST -U $DBROUSER $DBNAME -c '$1'"
50 PGPASSWORD="$DBROPW" $PGSQL $2 \
58 DBROCMD=pgsql_ro_query
59 DBRAWPARAMS="-A -q -t"