aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v5/db_indexes.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2014-05-18 08:53:33 -0400
committerRalph Amissah <ralph@amissah.com>2014-05-18 08:53:36 -0400
commit7bfd567154b9fd468e5df53901c3d8c383cc25f8 (patch)
tree9967a2bc8fa8880193285f2dd52d77186bdb072d /lib/sisu/v5/db_indexes.rb
parentv5 v6: db, use symbols to identify sql engine (diff)
v5 v6: db, remove ruby-dbi, for: pg ruby-pg, sqlite ruby-sqlite3 (already uses)
* ruby-pg require for postgresql * ruby-sqlite3 require for sqlite3 (done previously: already using ruby-sqlite3 rather than ruby-dbi) * ruby-dbi remove calls (in any common files & sisu pg and sisu sqlite3) * separate pg and sqlite db actions
Diffstat (limited to 'lib/sisu/v5/db_indexes.rb')
-rw-r--r--lib/sisu/v5/db_indexes.rb16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/sisu/v5/db_indexes.rb b/lib/sisu/v5/db_indexes.rb
index 8a269a4c..7e1164ab 100644
--- a/lib/sisu/v5/db_indexes.rb
+++ b/lib/sisu/v5/db_indexes.rb
@@ -67,10 +67,24 @@ module SiSU_DbIndex
@opt,@conn,@file,@sql_type=opt,conn,file,sql_type
end
def create_indexes # check added from pg not tested
+ def conn_execute_sql_pg(conn,sql)
+ conn.exec_params(sql)
+ end
+ def conn_execute_sql_sqlite(conn,sql)
+ conn.execute(sql)
+ end
+ def conn_execute_sql(conn,sql)
+ if @sql_type==:pg
+ conn_execute_sql_pg(conn,sql)
+ elsif @sql_type==:sqlite
+ conn_execute_sql_sqlite(conn,sql)
+ else
+ end
+ end
def conn_execute_array(sql_arr)
@conn.transaction do |conn|
sql_arr.each do |sql|
- conn.execute(sql)
+ conn_execute_sql(conn,sql)
end
end
end