Skip to content

Commit e3cc7b9

Browse files
committed
Remove some trivial helper functions
They were actually leading to double password reading in the `load` command.
1 parent 6b647b6 commit e3cc7b9

File tree

1 file changed

+9
-23
lines changed

1 file changed

+9
-23
lines changed

sql/dj_setup_database.in

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -240,23 +240,6 @@ install_examples()
240240
( cd "$EXAMPLEPROBDIR" && yes y | "$BINDIR"/import-contest )
241241
}
242242

243-
uninstall_helper()
244-
{
245-
read_dbpasswords
246-
remove_db_users
247-
}
248-
249-
create_db_users_helper()
250-
{
251-
read_dbpasswords
252-
create_db_users
253-
verbose "Created empty database and users."
254-
}
255-
256-
create_database_dump () {
257-
mysqldump $(mysql_options) --opt --skip-lock-tables "$DBNAME" | pv | gzip > "$DATABASEDUMPDIR/${1}.sql.gz"
258-
}
259-
260243
### Script starts here ###
261244

262245
# Parse command-line options:
@@ -313,7 +296,8 @@ genpass)
313296
;;
314297

315298
uninstall)
316-
uninstall_helper
299+
read_dbpasswords
300+
remove_db_users
317301
;;
318302

319303
install-examples)
@@ -332,7 +316,8 @@ install-loadtest)
332316
;;
333317

334318
create-db-users)
335-
create_db_users_helper
319+
read_dbpasswords
320+
create_db_users
336321
;;
337322

338323
bare-install|install)
@@ -377,7 +362,8 @@ dump)
377362
exit 1
378363
fi
379364

380-
if [ -f "${DATABASEDUMPDIR}/${DUMPNAME}.sql.gz" ]; then
365+
DUMPFILE="${DATABASEDUMPDIR}/${DUMPNAME}.sql.gz"
366+
if [ -f "$DUMPFILE" ]; then
381367
while true; do
382368
printf "Overwrite existing database dump (y/N)? "
383369
read -r yn
@@ -387,7 +373,7 @@ dump)
387373
esac
388374
done
389375
fi
390-
create_database_dump "$DUMPNAME"
376+
mysqldump $(mysql_options) --opt --skip-lock-tables "$DBNAME" | pv | gzip > "$DUMPFILE"
391377
;;
392378

393379
load)
@@ -429,8 +415,8 @@ load)
429415
fi
430416

431417
read_dbpasswords
432-
uninstall_helper
433-
create_db_users_helper
418+
remove_db_users
419+
create_db_users
434420
pv "${FILE}" | gunzip | mysql "$DBNAME"
435421
;;
436422

0 commit comments

Comments
 (0)