4fcb0935ce732ca2ad9b65d81641ecbf60c4a392
[freeside.git] / htdocs / docs / man / dbdef_table.txt
1 NAME
2     FS::dbdef_table - Table objects
3
4 SYNOPSIS
5       use FS::dbdef_table;
6
7       $dbdef_table = new FS::dbdef_table (
8         "table_name",
9         "primary_key",
10         $FS_dbdef_unique_object,
11         $FS_dbdef_index_object,
12         @FS_dbdef_column_objects,
13       );
14
15       $dbdef_table->addcolumn ( $FS_dbdef_column_object );
16
17       $table_name = $dbdef_table->name;
18       $dbdef_table->name ("table_name");
19
20       $table_name = $dbdef_table->primary_keye;
21       $dbdef_table->primary_key ("primary_key");
22
23       $FS_dbdef_unique_object = $dbdef_table->unique;
24       $dbdef_table->unique ( $FS_dbdef_unique_object );
25
26       $FS_dbdef_index_object = $dbdef_table->index;
27       $dbdef_table->index ( $FS_dbdef_index_object );
28
29       @column_names = $dbdef->columns;
30
31       $FS_dbdef_column_object = $dbdef->column;
32
33       @sql_statements = $dbdef->sql_create_table;
34       @sql_statements = $dbdef->sql_create_table $datasrc;
35
36 DESCRIPTION
37     FS::dbdef_table objects represent a single database table.
38
39 METHODS
40     new Creates a new FS::dbdef_table object.
41
42     addcolumn
43         Adds this FS::dbdef_column object.
44
45     name
46         Returns or sets the table name.
47
48     primary_key
49         Returns or sets the primary key.
50
51     unique
52         Returns or sets the FS::dbdef_unique object.
53
54     index
55         Returns or sets the FS::dbdef_index object.
56
57     columns
58         Returns a list consisting of the names of all columns.
59
60     column "column"
61         Returns the column object (see the FS::dbdef_column manpage)
62         for "column".
63
64     sql_create_table [ $datasrc ]
65         Returns an array of SQL statments to create this table.
66
67         If passed a DBI $datasrc specifying the DBD::mysql manpage,
68         will use MySQL-specific syntax. Non-standard syntax for
69         other engines (if applicable) may also be supported in the
70         future.
71
72 BUGS
73 SEE ALSO
74     the FS::dbdef manpage, the FS::dbdef_unique manpage, the
75     FS::dbdef_index manpage, the FS::dbdef_unique manpage, the DBI
76     manpage
77
78 VERSION
79     $Id: dbdef_table.txt,v 1.2 1998-10-14 06:52:48 ivan Exp $
80
81 HISTORY
82     class for dealing with table definitions
83
84     ivan@sisd.com 98-apr-18
85
86     gained extra functions (should %columns be an IxHash?)
87     ivan@sisd.com 98-may-11
88
89     sql_create_table returns a list of statments, not just one, and
90     now it does indices (plus mysql hack) ivan@sisd.com 98-jun-2
91
92     untaint primary_key... hmm. is this a hack around a bigger
93     problem? looks like, did the same thing singles in colgroup!
94     ivan@sisd.com 98-jun-4
95
96     pod ivan@sisd.com 98-sep-24
97
98     $Log: dbdef_table.txt,v $
99     Revision 1.2  1998-10-14 06:52:48  ivan
100     1,1,4 release, fix postgresql quirks.
101
102