Module: JDBCHelper::SQLPrepared Deprecated

Defined in:
lib/jdbc-helper/sql/sql_prepared.rb

Overview

Deprecated.

Class Method Summary collapse

Class Method Details

.count(table, conds = nil) ⇒ Object

Deprecated.

Generates count SQL with the given conditions



62
63
64
65
66
# File 'lib/jdbc-helper/sql/sql_prepared.rb', line 62

def self.count table, conds = nil
  sql, *binds =
    SQLHelper.count :table => table, :where => conds, :prepared => true
  [sql, binds]
end

.delete(table, conds = nil) ⇒ Object

Deprecated.

Generates delete SQL with the given conditions



70
71
72
73
# File 'lib/jdbc-helper/sql/sql_prepared.rb', line 70

def self.delete table, conds = nil
  sql, *binds = SQLHelper.delete :table => table, :where => conds, :prepared => true
  [sql, binds]
end

.insert(table, data_hash) ⇒ Object

Deprecated.

SQL Helpers

Generates insert SQL with hash



21
22
23
24
# File 'lib/jdbc-helper/sql/sql_prepared.rb', line 21

def self.insert table, data_hash
  sql, *binds = SQLHelper.insert :table => table, :data => data_hash, :prepared => true
  [sql, binds]
end

.insert_ignore(table, data_hash) ⇒ Object

Deprecated.

Generates insert ignore SQL (Non-standard syntax)



28
29
30
31
# File 'lib/jdbc-helper/sql/sql_prepared.rb', line 28

def self.insert_ignore table, data_hash
  sql, *binds = SQLHelper.insert_ignore :table => table, :data => data_hash, :prepared => true
  [sql, binds]
end

.replace(table, data_hash) ⇒ Object

Deprecated.

Generates replace SQL (Non-standard syntax)



35
36
37
38
# File 'lib/jdbc-helper/sql/sql_prepared.rb', line 35

def self.replace table, data_hash
  sql, *binds = SQLHelper.replace :table => table, :data => data_hash, :prepared => true
  [sql, binds]
end

.select(table, opts = {}) ⇒ Object

Deprecated.

Generates select SQL with the given conditions



51
52
53
54
55
56
57
58
# File 'lib/jdbc-helper/sql/sql_prepared.rb', line 51

def self.select table, opts = {}
  sql, *binds = SQLHelper.select :table => table,
                   :project  => opts[:select],
                   :where    => opts[:where],
                   :order    => opts[:order],
                   :prepared => true
  [sql, binds]
end

.update(table, data_hash, where) ⇒ Object

Deprecated.

Generates update SQL with hash. :where element of the given hash is taken out to generate where clause.



43
44
45
46
47
# File 'lib/jdbc-helper/sql/sql_prepared.rb', line 43

def self.update table, data_hash, where
  sql, *binds =
    SQLHelper.update :table => table, :data => data_hash, :where => where, :prepared => true
  [sql, binds]
end

.where(*conds) ⇒ Object

Deprecated.

Generates SQL where cluase with the given conditions. Parameter can be either Hash of String.



12
13
14
15
# File 'lib/jdbc-helper/sql/sql_prepared.rb', line 12

def self.where *conds
  sql, *binds = SQLHelper.where_prepared(*conds)
  [sql, binds]
end