]>
gitweb.michael.orlitzky.com - mailshears.git/blob - plugins/roundcube_db.rb
3 require 'common/roundcube_db_plugin'
8 include RoundcubeDbPlugin
11 def delete_account(account
)
12 # Delete the given username and any records in other tables
14 user_id
= self.get_user_id(account
)
16 # The Roundcube developers were nice enough to include
17 # DBMS-specific install and upgrade scripts, so Postgres can take
18 # advantage of ON DELETE triggers. Here's an example:
21 # user_id integer NOT NULL
22 # REFERENCES users (user_id) ON DELETE CASCADE ON UPDATE CASCADE
24 # This query is of course necessary with any DBMS:
25 sql_queries
= ['DELETE FROM users WHERE user_id = $1::int;']
28 connection
= PGconn
.connect(@db_host,
36 sql_queries
.each
do |sql_query
|
37 connection
.query(sql_query
, [user_id
])
43 # Pretend like we're database-agnostic in case we ever are.
44 raise DatabaseError
.new(e
)