M
Michael Linfield
So i have postgres setup and the database is working all fine and
dandy, but heres my issues.
The basic framework contains users, groups, events, and projects. I
want to give users the ability to join the groups events projects ect.
and further more be able to invite other users to those projects events
ect. All the meanwhile storing this in an SQL database.
my initial thoughts were of course to set up a table for users groups
projects and events using a seperate script to purely create the tables.
Then in a second script the actual user functions take place.
Basically if i defined a function for example to add a user to a group,
how would i properly query the sql server to let the people know that
user1 has been successfully added to the group, and further more
retrieve that information that user1 is in group2 later down the road.
In simpler words, whats an efficient way to retrieve data via sql.
require 'rubygems'
require 'postgres'
require 'socket'
def database
@connection =
PGconn.connect("localhost",5432,"","","database","god","password")
begin
yield @connection
ensure
@connection.close
end
end
database do |x|
x.exec("create table users ( name char(12) default 0 );")
x.exec("create table groups ( group char(12) default 0 );")
x.exec("create table events ( event char(12) default 0 );")
x.exec("create table projects ( project char(12) default 0 );")
end
#
and then further on i would need to somehow create addition columns in
those tables to add users to the list in those particular groups events
ect.
Any guidance would be much appreciated!
Thanks!
- Mac
dandy, but heres my issues.
The basic framework contains users, groups, events, and projects. I
want to give users the ability to join the groups events projects ect.
and further more be able to invite other users to those projects events
ect. All the meanwhile storing this in an SQL database.
my initial thoughts were of course to set up a table for users groups
projects and events using a seperate script to purely create the tables.
Then in a second script the actual user functions take place.
Basically if i defined a function for example to add a user to a group,
how would i properly query the sql server to let the people know that
user1 has been successfully added to the group, and further more
retrieve that information that user1 is in group2 later down the road.
In simpler words, whats an efficient way to retrieve data via sql.
require 'rubygems'
require 'postgres'
require 'socket'
def database
@connection =
PGconn.connect("localhost",5432,"","","database","god","password")
begin
yield @connection
ensure
@connection.close
end
end
database do |x|
x.exec("create table users ( name char(12) default 0 );")
x.exec("create table groups ( group char(12) default 0 );")
x.exec("create table events ( event char(12) default 0 );")
x.exec("create table projects ( project char(12) default 0 );")
end
#
and then further on i would need to somehow create addition columns in
those tables to add users to the list in those particular groups events
ect.
Any guidance would be much appreciated!
Thanks!
- Mac