PG Gem Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Ruby PG Gem

create a new PG:Connection object

A

PG.connect(dbname: “a_database”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Ruby PG Gem

execute a SQL query and return a PG::Result object

A

connection.exec(“SELECT * FROM…”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Ruby PG Gem

return an array of arrays containing values for each row in result

A

result.values

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Ruby PG Gem

return the names of columns as an array of strings

A

result.fields

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Ruby PG Gem

return the number of rows in result

A

result.ntuples

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Ruby PG Gem

yield a hash of column names and values to the block for each row in result

A

result.each(&block)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Ruby PG Gem

yield an array of values to the block for each row in result

A

result.each_row(&block)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Ruby PG Gem

return a hash of values for row at index in result

A

result[index]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Ruby PG Gem

return an array of values for column, one for each row in result

A

result.field_values(column)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Ruby PG Gem

return an array of values for column at index, one for each row in result

A

result.column_values(index)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Ruby PG Gem

PG.connect(dbname: “a_database”)

A

create a new PG:Connection object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Ruby PG Gem

connection.exec(“SELECT * FROM…”)

A

execute a SQL query and return a PG::Result object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Ruby PG Gem

result.values

A

return an array of arrays containing values for each row in result

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Ruby PG Gem

result.fields

A

return the names of columns as an array of strings

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Ruby PG Gem

result.ntuples

A

return the number of rows in result

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Ruby PG Gem

result.each(&block)

A

yield a hash of column names and values to the block for each row in result

17
Q

Ruby PG Gem

result.each_row(&block)

A

yield an array of values to the block for each row in result

18
Q

Ruby PG Gem

result[index]

A

return a hash of values for row at index in result

19
Q

Ruby PG Gem

result.field_values(column)

A

return an array of values for column, one for each row in result

20
Q

Ruby PG Gem

result.column_values(index)

A

return an array of values for column at index, one for each row in result