Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
activerecord-monetdb-adapter
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
simcaq
activerecord-monetdb-adapter
Commits
8c6c4677
Commit
8c6c4677
authored
Aug 07, 2012
by
Pavel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed delete() method
parent
c20760d9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
43 deletions
+48
-43
adapter/lib/active_record/connection_adapters/monetdb_adapter.rb
.../lib/active_record/connection_adapters/monetdb_adapter.rb
+48
-43
No files found.
adapter/lib/active_record/connection_adapters/monetdb_adapter.rb
View file @
8c6c4677
...
...
@@ -449,6 +449,11 @@ module ActiveRecord
def
last_inserted_id
(
result
)
result
.
last_insert_id
end
def
delete
(
arel
,
name
=
nil
,
binds
=
[])
res
=
super
(
arel
,
name
,
binds
)
res
.
affected_rows
end
# Begins the transaction.
def
begin_db_transaction
...
...
@@ -501,57 +506,57 @@ module ActiveRecord
#=======END=OF=DATABASE=STATEMENTS=========#
protected
# restructure result returned by execute
def
process_hdl
(
hdl
)
result
=
[]
if
(
num_rows
=
hdl
.
num_rows
)
>
0
fields
=
hdl
.
name_fields
# restructure result returned by execute
def
process_hdl
(
hdl
)
result
=
[]
num_rows
.
times
do
result
<<
{}
end
if
(
num_rows
=
hdl
.
num_rows
)
>
0
fields
=
hdl
.
name_fields
fields
.
each
do
|
f
|
cols
=
hdl
.
fetch_column_name
(
f
)
cols
.
each_with_index
do
|
val
,
i
|
val
=
nil
if
val
==
'NULL'
result
[
i
][
f
]
=
val
end
end
num_rows
.
times
do
result
<<
{}
end
result
fields
.
each
do
|
f
|
cols
=
hdl
.
fetch_column_name
(
f
)
cols
.
each_with_index
do
|
val
,
i
|
val
=
nil
if
val
==
'NULL'
result
[
i
][
f
]
=
val
end
end
end
# Returns an array of record hashes with the column names as keys and
# column values as values.
def
select
(
sql
,
name
=
nil
,
binds
=
[])
hdl
=
execute
(
sql
,
name
)
result
end
process_hdl
(
hdl
)
end
# Executes the update statement and returns the number of rows affected.
def
update_sql
(
sql
,
name
=
nil
)
hdl
=
execute
(
sql
,
name
)
# affected_rows = hdl.affected_rows
return
false
end
# Returns the last auto-generated ID from the affected table.
def
insert_sql
(
sql
,
name
=
nil
,
pk
=
nil
,
id_value
=
nil
,
sequence_name
=
nil
)
# Ensures that the auto-generated id value will not violate the
# primary key constraint. Read the comments of make_sure_pk_works
# and documentation for further information.
# comment out for production code(?)
# table_name = extract_table_name_from_insertion_query(sql)
# make_sure_pk_works(table_name,name)
hdl
=
execute
(
sql
,
name
)
# last_auto_generated_id = hdl.get_last_auto_generated_id
end
# Returns an array of record hashes with the column names as keys and
# column values as values.
def
select
(
sql
,
name
=
nil
,
binds
=
[])
hdl
=
execute
(
sql
,
name
)
process_hdl
(
hdl
)
end
# Executes the update statement and returns the number of rows affected.
def
update_sql
(
sql
,
name
=
nil
)
hdl
=
execute
(
sql
,
name
)
hdl
.
affected_rows
end
# Returns the last auto-generated ID from the affected table.
def
insert_sql
(
sql
,
name
=
nil
,
pk
=
nil
,
id_value
=
nil
,
sequence_name
=
nil
)
# Ensures that the auto-generated id value will not violate the
# primary key constraint. Read the comments of make_sure_pk_works
# and documentation for further information.
# comment out for production code(?)
# table_name = extract_table_name_from_insertion_query(sql)
# make_sure_pk_works(table_name,name)
hdl
=
execute
(
sql
,
name
)
hdl
.
last_insert_id
end
protected
# Some tests insert some tuples with the id values set. In other words, the sequence
# is not used to generate a value for the primary key column named id. When a new tuple
# it to be inserted, where the id value is not set explicitly, a primary key violation will
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment