5 string describe() { return "PostgresHandle"; }
9 array result = oHandle->list_tables() || ({ });
11 foreach( result, string tname ) {
12 sscanf(tname, "%s_key%s", a, b);
13 if ( search(tname, "sql_") != 0 &&
14 search(tname, "_pkey") == -1 &&
15 search(tname, "_key") == -1 &&
16 search(tname, "_i_") == -1 )
17 tables += ({ tname });
22 string quote_index(mixed index) {
23 if ( !stringp(index) )
25 return oHandle->quote(string_to_utf8(lower_case(utf8_to_string(index))));
28 string create_insert_statement(array sStatements)
31 foreach(sStatements, string statement) {
32 s+= "insert into ob_data values " + statement + ";";
37 void check_tables() { }
39 void create_table(string name, array types)
41 string query = "create table " + name + " (";
42 for ( int i = 0; i < sizeof(types) - 1; i++ ) {
43 mapping type = types[i];
44 query += type->name + " " + type->type + ",";
46 query += types[sizeof(types)-1]->name + " " + types[sizeof(types)-1]->type;
49 mapping check_updates(object dbupdates, function update_classtableobject)
54 string escape_blob(string data)
56 return replace(data, ({ "\0", "\\", "'" }),
57 ({ "\\\\000", "\\\\134", "\\\\047" }));
60 string unescape_blob(string data)
62 return replace(data, ({ "\\\\000", "\\\\134", "\\\\047" }),
63 ({ "\0", "\\", "'" }));
66 string get_database() { return "postgres"; }
70 MESSAGE("creating table \"doc_data\" ");
71 oHandle->big_query("create table doc_data ("+
75 " primary key (doc_id, rec_order)"+
77 MESSAGE("creating table \"ob_class\" ");
78 oHandle->big_query("create table ob_class ("+
79 " ob_id int primary key, "+
83 " obdescription text, "+
84 " obmimetype text, " +
88 oHandle->query("create index _i_obdescription on ob_class (obdescription)");
89 oHandle->query("create index _i_obkeywords on ob_class (obkeywords)");
90 oHandle->query("create index _i_obname on ob_class (obname)");
91 oHandle->query("create index _i_obmimetype on ob_class (obmimetype)");
92 oHandle->query("create index _i_obversionof on ob_class (obversionof)");
94 MESSAGE("creating table \"ob_data\" ");
95 oHandle->big_query("create table ob_data ("+
100 " unique(ob_id, ob_ident, ob_attr)"+
103 oHandle->query("create index _i_obdata on ob_data (ob_ident, ob_attr, ob_data)");
105 MESSAGE("creating table \"variables\" ");
106 oHandle->big_query("create table variables ("+
107 " var text primary key, "+