Qore SchemaReverse Module Reference  1.1

SchemaReverse module provides functionality to create Qore source code usable as an input for Schema::AbstractSchema (Schema.qm user module).

To use this module, use "%requires SchemaReverse" in your code.

All the public symbols in the module are defined in the SchemaReverse namespace.

Currently it can handle only database object types.

  • sequences
  • tables
  • types
  • views
  • materialized views
  • functions
  • procedures
  • packages

Not all database object types are available in all DBMS.

Simple example (to get one table definition):

%new-style
%requires SchemaReverse
Datasource ds("oracle:omq/omq@xbpx");
on_exit ds.commit();
TableReverse t = SchemaReverse::get_object("table", ds, "schema_reverse_t1");
string str = t.toString();
printf("%N\n", str);

The output will be:

(
"columns" :
(
"id" :
(
"qore_type" : "number",
"comment" : "comment for id",
"notnull" : True,
),
"foo" :
(
"qore_type" : "string",
"size" : 10,
"comment" : "comment for foo",
),
"bar" :
(
"qore_type" : "date",
"driver" :
(
"oracle" :
(
"native_type" : "date",
),
"pgsql" :
(
"native_type" : "date",
),
),
"comment" : "comment for bar",
"notnull" : True,
),
),
"indexes" :
(
"schema_reverse_ix1" :
(
"columns" :
("id",),
"unique" : True,
),
),
)
True
const True
printf
string printf(string fmt,...)