wow, that was fast! i'll put this in svn tonight, and see about an upload right away.
thanks!
sean
On Sun, 2007-05-20 at 22:26 +0200, Vincent Bernat wrote:
> tag 425262 patch
> thanks
>
> OoO Pendant le journal télévisé du dimanche 20 mai 2007, vers 20:29,
> "Matt Brown" <[EMAIL PROTECTED]> disait:
>
> > What I was trying to say originally is that regardless of how sqlite3
> > is handled my hope is that it doesn't require too much duplication of
> > dbconfig-common code. Even if it is functionally a completely separate
> > backend to sqlite it should still be able to share most of the exist
> > sqlite code.
>
> Here is a patch that adds sqlite3 backend. It is very light and I have
> tested with sqlite and sqlite3 examples without any problem (I have
> tried without sqlite3 and without sqlite installed respectively).
>
> The whole patch is attached to this message but I include the most
> useful parts of it below to allow you to comment it if you want. The
> rest of the patch is just adding sqlite3 as an example and post*.sqlite
> files.
>
> Index: dpkg/common
> ===================================================================
> --- dpkg/common (révision 399)
> +++ dpkg/common (copie de travail)
> @@ -43,7 +43,7 @@
> dbc_sqlite_templates="db/dbname db/basepath"
>
> # all dbtypes supported by dbconfig-common
> - dbc_all_supported_dbtypes="mysql pgsql sqlite"
> + dbc_all_supported_dbtypes="mysql pgsql sqlite sqlite3"
>
> # database types supporting authenticated access
> dbc_authenticated_dbtypes="mysql pgsql"
> @@ -52,7 +52,7 @@
> dbc_remote_dbtypes="mysql pgsql"
>
> # database types storing files on the filesystem
> - dbc_fs_dbtypes="sqlite"
> + dbc_fs_dbtypes="sqlite sqlite3"
>
> ###
> ### source the pre-existing config, if it exists
> @@ -117,7 +117,7 @@
> dbc_use_dbuser="false"
> dbc_dbvendor="PostgreSQL"
> ;;
> - sqlite)
> + sqlite|sqlite3)
> . /usr/share/dbconfig-common/internal/sqlite
> dbc_createuser_cmd=true
> dbc_checkuser_cmd=true
> @@ -130,9 +130,10 @@
> dbc_register_templates="$dbc_standard_templates
> $dbc_sqlite_templates"
> dbc_default_admin=""
> dbc_default_dbuser="";
> -
> dbc_default_basepath="/var/lib/dbconfig-common/sqlite/$dbc_package"
> +
> dbc_default_basepath="/var/lib/dbconfig-common/$dbc_dbtype/$dbc_package"
> dbc_use_dbuser="false"
> dbc_dbvendor="SQLite"
> + dbc_sqlite_cmd="/usr/bin/$dbc_dbtype"
> ;;
> *)
> dbc_register_templates="$dbc_standard_templates
> $dbc_mysql_templates $dbc_pgsql_templates $dbc_sqlite_templates"
> @@ -831,6 +832,8 @@
> ;;
> "sqlite") testfile='/usr/bin/sqlite'
> ;;
> + "sqlite3") testfile='/usr/bin/sqlite3'
> + ;;
> "")
> ;;
> esac
> Index: internal/sqlite
> ===================================================================
> --- internal/sqlite (révision 399)
> +++ internal/sqlite (copie de travail)
> @@ -33,7 +33,7 @@
> return 1
> fi
> l_retval=0
> - sqlite "$l_dbfile" < "$l_sqlfile" || l_retval=$?
> + $dbc_sqlite_cmd "$l_dbfile" < "$l_sqlfile" || l_retval=$?
> return $l_retval
> }
>
> @@ -78,7 +78,7 @@
> local ret l_dbfile l_owner l_perms
> dbc_status=error
>
> - _dbc_sanity_check dbname sqlite || return 1
> + _dbc_sanity_check dbname $dbc_dbtype || return 1
>
> l_dbfile="${dbc_basepath}/${dbc_dbname}"
>
> @@ -173,7 +173,7 @@
> dbc_sqlite_dump(){
> local dumpfile
> dumpfile=$1
> - _dbc_sanity_check dbname sqlite || return 1
> + _dbc_sanity_check dbname $dbc_dbtype || return 1
> dbc_sqlite_exec_command ".dump" > "$dumpfile"
> return $?
> }
> Index: internal/common
> ===================================================================
> --- internal/common (révision 399)
> +++ internal/common (copie de travail)
> @@ -113,11 +113,11 @@
> return 1
> fi
> ;;
> - "sqlite")
> - if ! which sqlite >/dev/null; then
> - dbc_error="No sqlite client to execute. (have
> - you installed the sqlite package?"
> - dbc_logline "sanity check failed for sqlite"
> + "sqlite"|"sqlite3")
> + if ! which $1 >/dev/null; then
> + dbc_error="No $1 client to execute. (have
> + you installed the $1 package?"
> + dbc_logline "sanity check failed for $1"
> return 1
> fi
> ;;
>
> Real patch :
>
signature.asc
Description: This is a digitally signed message part

