summaryrefslogtreecommitdiff
path: root/htdocs/docs/man/dbdef_table.txt
blob: 25e010d8b3da07ecfacd6435afa2d45dfd78b238 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
NAME
    FS::dbdef_table - Table objects

SYNOPSIS
      use FS::dbdef_table;

      $dbdef_table = new FS::dbdef_table (
        "table_name",
        "primary_key",
        $FS_dbdef_unique_object,
        $FS_dbdef_index_object,
        @FS_dbdef_column_objects,
      );

      $dbdef_table->addcolumn ( $FS_dbdef_column_object );

      $table_name = $dbdef_table->name;
      $dbdef_table->name ("table_name");

      $table_name = $dbdef_table->primary_keye;
      $dbdef_table->primary_key ("primary_key");

      $FS_dbdef_unique_object = $dbdef_table->unique;
      $dbdef_table->unique ( $FS_dbdef_unique_object );

      $FS_dbdef_index_object = $dbdef_table->index;
      $dbdef_table->index ( $FS_dbdef_index_object );

      @column_names = $dbdef->columns;

      $FS_dbdef_column_object = $dbdef->column;

      @sql_statements = $dbdef->sql_create_table;
      @sql_statements = $dbdef->sql_create_table $datasrc;

DESCRIPTION
    FS::dbdef_table objects represent a single database table.

METHODS
    new Creates a new FS::dbdef_table object.

    addcolumn
        Adds this FS::dbdef_column object.

    name
        Returns or sets the table name.

    primary_key
        Returns or sets the primary key.

    unique
        Returns or sets the FS::dbdef_unique object.

    index
        Returns or sets the FS::dbdef_index object.

    columns
        Returns a list consisting of the names of all columns.

    column "column"
        Returns the column object (see the FS::dbdef_column manpage)
        for "column".

    sql_create_table [ $datasrc ]
        Returns an array of SQL statments to create this table.

        If passed a DBI $datasrc specifying the DBD::mysql manpage,
        will use MySQL-specific syntax. Non-standard syntax for
        other engines (if applicable) may also be supported in the
        future.

BUGS
SEE ALSO
    the FS::dbdef manpage, the FS::dbdef_unique manpage, the
    FS::dbdef_index manpage, the FS::dbdef_unique manpage, the DBI
    manpage

HISTORY
    class for dealing with table definitions

    ivan@sisd.com 98-apr-18

    gained extra functions (should %columns be an IxHash?)
    ivan@sisd.com 98-may-11

    sql_create_table returns a list of statments, not just one, and
    now it does indices (plus mysql hack) ivan@sisd.com 98-jun-2

    untaint primary_key... hmm. is this a hack around a bigger
    problem? looks like, did the same thing singles in colgroup!
    ivan@sisd.com 98-jun-4

    pod ivan@sisd.com 98-sep-24