BEGIN TRANSACTION;
CREATE TABLE kexi__db (db_property Text(32), db_value CLOB);
INSERT INTO "kexi__db" VALUES('kexidb_major_ver', '1');
INSERT INTO "kexi__db" VALUES('kexidb_minor_ver', '2');
INSERT INTO "kexi__db" VALUES('kexiproject_major_ver', '1');
INSERT INTO "kexi__db" VALUES('kexiproject_minor_ver', '0');
CREATE TABLE kexi__fields (t_id UNSIGNED Integer, f_type UNSIGNED Byte, f_name Text(200), f_length Integer, f_precision Integer, f_constraints Integer, f_options Integer, f_default Text(200), f_order Integer, f_caption Text(200), f_help CLOB);
INSERT INTO "kexi__fields" VALUES(1, 3, 'id', 0, 0, 119, 1, NULL, 1, 'ID', NULL);
INSERT INTO "kexi__fields" VALUES(1, 3, 'age', 0, 0, 0, 1, NULL, 2, 'Age', NULL);
INSERT INTO "kexi__fields" VALUES(1, 11, 'name', 200, 0, 0, 0, NULL, 3, 'Name', NULL);
INSERT INTO "kexi__fields" VALUES(1, 11, 'surname', 200, 0, 0, 0, NULL, 4, 'Surname', NULL);
INSERT INTO "kexi__fields" VALUES(53, 11, 'a', 200, 0, 0, 200, '1', 0, NULL, NULL);
INSERT INTO "kexi__fields" VALUES(53, 11, 'b', 200, 0, 0, 200, '2', 1, NULL, NULL);
INSERT INTO "kexi__fields" VALUES(2, 3, 'id', 0, 0, 119, 1, NULL, 0, 'ID', NULL);
INSERT INTO "kexi__fields" VALUES(2, 11, 'model', 200, 0, 0, 0, NULL, 1, 'Car model', NULL);
INSERT INTO "kexi__fields" VALUES(103, 4, 'id', 0, 0, 119, 1, NULL, 0, 'Id', NULL);
INSERT INTO "kexi__fields" VALUES(103, 3, 'owner', 0, 0, 0, 0, NULL, 1, 'Owner', NULL);
INSERT INTO "kexi__fields" VALUES(103, 3, 'car', 0, 0, 0, 0, NULL, 2, 'Car', NULL);
INSERT INTO "kexi__fields" VALUES(103, 3, 'since', 0, 0, 0, 0, NULL, 3, 'Since', NULL);
CREATE TABLE kexi__objectdata (o_id UNSIGNED Integer NOT NULL, o_data CLOB, o_sub_id Text(200));
INSERT INTO "kexi__objectdata" VALUES(4, '<!DOCTYPE UI>
<UI stdsetdef="1" version="3.1" >
<kfd:customHeader version="2" />
<pixmapinproject/>
<class>TQWidget</class>
<widget class="TQWidget" >
<property name="name" >
<cstring>formularz1</cstring>
</property>
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>500</width>
<height>200</height>
</rect>
</property>
<property name="caption" >
<string>formularz1</string>
</property>
<property name="dataSource" >
<string>persons</string>
</property>
<property name="dataSourceMimeType" >
<cstring>kexi/table</cstring>
</property>
<property name="paletteBackgroundColor" >
<color>
<red>255</red>
<green>220</green>
<blue>168</blue>
</color>
</property>
<widget class="KexiDBLabel" >
<property name="name" >
<cstring>TextLabel1</cstring>
</property>
<property name="geometry" >
<rect>
<x>20</x>
<y>40</y>
<width>152</width>
<height>36</height>
</rect>
</property>
<property name="dataSource" >
<string>name</string>
</property>
<property name="font" >
<font>
<family>Verdana</family>
<pointsize>12</pointsize>
<weight>50</weight>
<bold>0</bold>
<italic>1</italic>
<underline>0</underline>
<strikeout>0</strikeout>
</font>
</property>
<property name="shadowEnabled" >
<bool>true</bool>
</property>
<property name="text" >
<string>Name</string>
</property>
<property name="alignment" >
<set>WordBreak|AlignBottom</set>
</property>
</widget>
<widget class="Line" >
<property name="name" >
<cstring>Line1</cstring>
</property>
<property name="geometry" >
<rect>
<x>20</x>
<y>80</y>
<width>450</width>
<height>11</height>
</rect>
</property>
<property name="frameShadow" >
<enum>Plain</enum>
</property>
<property name="lineWidth" >
<number>3</number>
</property>
<property name="orientation" >
<enum>Horizontal</enum>
</property>
</widget>
<widget class="KexiDBLabel" >
<property name="name" >
<cstring>TextLabel2</cstring>
</property>
<property name="geometry" >
<rect>
<x>180</x>
<y>40</y>
<width>182</width>
<height>36</height>
</rect>
</property>
<property name="dataSource" >
<string>surname</string>
</property>
<property name="font" >
<font>
<family>Verdana</family>
<pointsize>12</pointsize>
<weight>50</weight>
<bold>0</bold>
<italic>1</italic>
<underline>0</underline>
<strikeout>0</strikeout>
</font>
</property>
<property name="shadowEnabled" >
<bool>true</bool>
</property>
<property name="text" >
<string>Surname</string>
</property>
<property name="alignment" >
<set>WordBreak|AlignBottom</set>
</property>
</widget>
<widget class="KexiDBImageBox" >
<property name="name" >
<cstring>obrazek2</cstring>
</property>
<property name="geometry" >
<rect>
<x>380</x>
<y>10</y>
<width>90</width>
<height>70</height>
</rect>
</property>
<property name="alignment" >
<set>AlignTop|AlignRight</set>
</property>
<property name="storedPixmapId" >
<number>3</number>
</property>
</widget>
<widget class="KexiDBAutoField" >
<property name="name" >
<cstring>age</cstring>
</property>
<property name="geometry" >
<rect>
<x>20</x>
<y>150</y>
<width>148</width>
<height>21</height>
</rect>
</property>
<property name="dataSource" >
<string>age</string>
</property>
</widget>
<widget class="KexiDBAutoField" >
<property name="name" >
<cstring>name</cstring>
</property>
<property name="geometry" >
<rect>
<x>10</x>
<y>100</y>
<width>159</width>
<height>21</height>
</rect>
</property>
<property name="autoCaption" >
<bool>false</bool>
</property>
<property name="dataSource" >
<string>name</string>
</property>
</widget>
<widget class="KexiDBAutoField" >
<property name="name" >
<cstring>surname</cstring>
</property>
<property name="geometry" >
<rect>
<x>170</x>
<y>100</y>
<width>200</width>
<height>21</height>
</rect>
</property>
<property name="autoCaption" >
<bool>false</bool>
</property>
<property name="dataSource" >
<string>surname</string>
</property>
</widget>
</widget>
<layoutDefaults spacing="6" margin="11" />
<tabstops>
<tabstop>TextLabel1</tabstop>
<tabstop>TextLabel2</tabstop>
<tabstop>obrazek2</tabstop>
<tabstop>age</tabstop>
<tabstop>name</tabstop>
<tabstop>surname</tabstop>
</tabstops>
</UI>
', NULL);
INSERT INTO "kexi__objectdata" VALUES(65, X'[encoded data, 8566 characters]', NULL);
INSERT INTO "kexi__objectdata" VALUES(96, '<!DOCTYPE UI>
<UI stdsetdef="1" version="3.1" >
 <pixmapinproject/>
 <class>TQWidget</class>
 <widget class="TQWidget" >
  <property name="name" >
   <cstring>report2</cstring>
  </property>
  <property name="geometry" >
   <rect>
    <x>0</x>
    <y>0</y>
    <width>590</width>
    <height>590</height>
   </rect>
  </property>
  <property name="caption" >
   <string></string>
  </property>
  <widget class="Label" >
   <property name="name" >
    <cstring>Label1</cstring>
   </property>
   <property name="geometry" >
    <rect>
     <x>10</x>
     <y>20</y>
     <width>566</width>
     <height>134</height>
    </rect>
   </property>
   <property name="backgroundOrigin" >
    <enum>ParentOrigin</enum>
   </property>
   <property name="font" >
    <font>
     <family>Trebuchet MS</family>
     <pointsize>48</pointsize>
     <weight>75</weight>
     <bold>1</bold>
     <italic>1</italic>
     <underline>0</underline>
     <strikeout>0</strikeout>
    </font>
   </property>
   <property name="text" >
    <string>Sales Report</string>
   </property>
  </widget>
  <widget class="PicLabel" >
   <property name="name" >
    <cstring>PicLabel1</cstring>
   </property>
   <property name="geometry" >
    <rect>
     <x>420</x>
     <y>170</y>
     <width>1</width>
     <height>1</height>
    </rect>
   </property>
   <property name="backgroundMode" >
    <enum>PaletteBackground</enum>
   </property>
   <property name="backgroundOrigin" >
    <enum>ParentOrigin</enum>
   </property>
   <property name="cursor" >
    <cursor>0</cursor>
   </property>
   <property name="frameShape" >
    <enum>NoFrame</enum>
   </property>
   <property name="pixmap" >
    <pixmap>image0</pixmap>
   </property>
   <property name="scaledContents" >
    <bool>true</bool>
   </property>
  </widget>
  <widget class="KexiSubReport" >
   <property name="name" >
    <cstring>SubReport1</cstring>
   </property>
   <property name="geometry" >
    <rect>
     <x>20</x>
     <y>170</y>
     <width>330</width>
     <height>290</height>
    </rect>
   </property>
  </widget>
 </widget>
 <images>
  <image name="image0" >
   <data format="XBM.GZ" length="79" >789c534e494dcbcc4b554829cdcdad8c2fcf4c29c95030e0524611cd48cd4ccf28010a1797249664262b2467241641a592324b8aa363156c15aab914146aadb90067111b1f</data>
  </image>
 </images>
 <layoutDefaults spacing="6" margin="11" />
 <tabstops>
  <tabstop>SubReport1</tabstop>
 </tabstops>
</UI>
', NULL);
INSERT INTO "kexi__objectdata" VALUES(101, '<!DOCTYPE script>
<script language="python" ># This is Technology Preview (BETA) version of scripting
# support in Kexi. The scripting API may change in details
# in the next Kexi version.
# For more information and documentation see
# http://www.kexi-project.org/scripting/

# Saves the contents of &quot;persons&quot; table, without the &quot;id&quot; column
# to a &quot;SimpleReport54321.txt&quot; text file in the current user''s home
# directory. Totals about average, minimum, maximum age are appended.

import krosskexidb, krosskexiapp, os, codecs

keximainwindow = krosskexiapp.get(&quot;KexiAppMainWindow&quot;)
connection = keximainwindow.getConnection()
table = connection.tableSchema(&quot;persons&quot;)
if not table:
	raise(&quot;No table ''persons''&quot;)
query = table.query()

cursor = connection.executeQuerySchema(query)
if not cursor:
	raise(&quot;Query failed&quot;)

sum = 0
max = 0
min = 1000
count = 0

# Walk through all items in the table.
filename = os.path.expanduser(&quot;~&quot;)+os.sep+&quot;SimpleReport54321.txt&quot;
f = codecs.open(filename, &quot;wt&quot;, &quot;utf-8&quot;)
if not f:
	raise(&quot;Opening file failed&quot;)
f.write(&quot;%s\t%s\t%s\n-------------------------\n&quot; 
	% (query.fieldlist().field(1).caption(),
	query.fieldlist().field(2).caption(),
	query.fieldlist().field(3).caption()))
while cursor.moveNext():
	count += 1
	sum += cursor.value(1)
	if max &lt; cursor.value(1):
		max = cursor.value(1)
	if min > cursor.value(1):
		min = cursor.value(1)
	f.write( &quot;%s\t%s\t%s\n&quot; % (cursor.value(1), cursor.value(2),cursor.value(3)))

f.write( &quot;\nAverage age:\t%.2f\n&quot; % (sum / count) )
f.write( &quot;Minimum age:\t%.2f\n&quot; % min)
f.write( &quot;Maximum age:\t%.2f\n&quot; % max)
f.close()
</script>
', NULL);
INSERT INTO "kexi__objectdata" VALUES(104, 'SELECT persons.name, persons.surname, persons.age, cars.model, ownership.since FROM persons, ownership, cars WHERE cars.id = ownership.car AND persons.id = ownership.owner', 'sql');
INSERT INTO "kexi__objectdata" VALUES(104, '<query_layout><table name="persons" x="380" y="54" width="110" height="132"/><table name="ownership" x="180" y="49" width="110" height="132"/><table name="cars" x="9" y="57" width="110" height="92"/><conn mtable="cars" mfield="id" dtable="ownership" dfield="car"/><conn mtable="persons" mfield="id" dtable="ownership" dfield="owner"/></query_layout>', 'query_layout');
INSERT INTO "kexi__objectdata" VALUES(103, '<!DOCTYPE EXTENDED_TABLE_SCHEMA>
<EXTENDED_TABLE_SCHEMA version="1" >
 <field name="owner" >
  <lookup-column>
   <row-source>
    <type>table</type>
    <name>persons</name>
   </row-source>
   <bound-column>
    <number>0</number>
   </bound-column>
   <visible-column>
    <number>3</number>
   </visible-column>
  </lookup-column>
 </field>
 <field name="car" >
  <lookup-column>
   <row-source>
    <type>table</type>
    <name>cars</name>
   </row-source>
   <bound-column>
    <number>0</number>
   </bound-column>
   <visible-column>
    <number>1</number>
   </visible-column>
  </lookup-column>
 </field>
</EXTENDED_TABLE_SCHEMA>
', 'extended_schema');
INSERT INTO "kexi__objectdata" VALUES(105, '<!DOCTYPE UI>
<UI stdsetdef="1" version="3.1" >
<kfd:customHeader version="2" />
<pixmapinproject/>
<class>TQWidget</class>
<widget class="TQWidget" >
<property name="name" >
<cstring>form1</cstring>
</property>
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>514</width>
<height>611</height>
</rect>
</property>
<property name="autoTabStops" >
<bool>true</bool>
</property>
<property name="dataSource" >
<string>ownership</string>
</property>
<property name="dataSourceMimeType" >
<cstring>kexi/table</cstring>
</property>
<property name="paletteBackgroundColor" >
<color>
<red>154</red>
<green>168</green>
<blue>198</blue>
</color>
</property>
<widget class="KexiDBComboBox" >
<property name="name" >
<cstring>comboBox</cstring>
</property>
<property name="geometry" >
<rect>
<x>100</x>
<y>90</y>
<width>121</width>
<height>26</height>
</rect>
</property>
<property name="dataSource" >
<string>owner</string>
</property>
</widget>
<widget class="KexiDBComboBox" >
<property name="name" >
<cstring>comboBox2</cstring>
</property>
<property name="geometry" >
<rect>
<x>100</x>
<y>130</y>
<width>121</width>
<height>26</height>
</rect>
</property>
<property name="dataSource" >
<string>car</string>
</property>
</widget>
<widget class="KexiDBLabel" >
<property name="name" >
<cstring>label</cstring>
</property>
<property name="geometry" >
<rect>
<x>20</x>
<y>90</y>
<width>55</width>
<height>29</height>
</rect>
</property>
<property name="text" >
<string>Owner:</string>
</property>
</widget>
<widget class="KexiDBLabel" >
<property name="name" >
<cstring>label2</cstring>
</property>
<property name="geometry" >
<rect>
<x>20</x>
<y>130</y>
<width>69</width>
<height>29</height>
</rect>
</property>
<property name="text" >
<string>Car:</string>
</property>
</widget>
<widget class="KexiDBLabel" >
<property name="name" >
<cstring>label3</cstring>
</property>
<property name="geometry" >
<rect>
<x>20</x>
<y>170</y>
<width>59</width>
<height>29</height>
</rect>
</property>
<property name="text" >
<string>Since:</string>
</property>
</widget>
<widget class="KexiDBLineEdit" >
<property name="name" >
<cstring>textBox</cstring>
</property>
<property name="geometry" >
<rect>
<x>100</x>
<y>170</y>
<width>172</width>
<height>26</height>
</rect>
</property>
<property name="dataSource" >
<string>since</string>
</property>
</widget>
<widget class="KexiDBLabel" >
<property name="name" >
<cstring>TextLabel1</cstring>
</property>
<property name="geometry" >
<rect>
<x>30</x>
<y>20</y>
<width>266</width>
<height>44</height>
</rect>
</property>
<property name="dataSource" >
<string></string>
</property>
<property name="font" >
<font>
<family>Verdana</family>
<pointsize>16</pointsize>
<weight>75</weight>
<bold>1</bold>
<italic>0</italic>
<underline>0</underline>
<strikeout>0</strikeout>
</font>
</property>
<property name="paletteBackgroundPixmap" />
<property name="shadowEnabled" >
<bool>true</bool>
</property>
<property name="text" >
<string>Ownership</string>
</property>
</widget>
<widget class="KexiDBImageBox" >
<property name="name" >
<cstring>image</cstring>
</property>
<property name="geometry" >
<rect>
<x>320</x>
<y>20</y>
<width>175</width>
<height>149</height>
</rect>
</property>
<property name="storedPixmapId" >
<number>5</number>
</property>
</widget>
</widget>
<includes>
<include location="global" impldecl="in implementation">kcombobox.h</include>
<include location="global" impldecl="in implementation">klineedit.h</include>
</includes>
<layoutDefaults spacing="6" margin="11" />
<tabstops>
<tabstop>TextLabel1</tabstop>
<tabstop>image</tabstop>
<tabstop>label</tabstop>
<tabstop>comboBox</tabstop>
<tabstop>label2</tabstop>
<tabstop>comboBox2</tabstop>
<tabstop>label3</tabstop>
<tabstop>textBox</tabstop>
</tabstops>
</UI>
', NULL);
INSERT INTO "kexi__objectdata" VALUES(106, '<!DOCTYPE macros>
<macro xmlversion="1" >
  <item action="open" >
    <variable name="name" >cars</variable>
    <variable name="object" >form</variable>
  </item>
  <item action="navigate" >
    <variable name="record" >last</variable>
  </item>
</macro>
', NULL);
INSERT INTO "kexi__objectdata" VALUES(107, 'SELECT name, surname, age FROM persons WHERE persons.age > [Enter minimum person''s age] ORDER BY age', 'sql');
INSERT INTO "kexi__objectdata" VALUES(107, NULL, 'query_layout');
CREATE TABLE kexi__objects (o_id INTEGER PRIMARY KEY, o_type UNSIGNED Byte, o_name Text(200), o_caption Text(200), o_desc CLOB);
INSERT INTO "kexi__objects" VALUES(1, 1, 'persons', 'Persons in our company', NULL);
INSERT INTO "kexi__objects" VALUES(2, 1, 'cars', 'Cars', NULL);
INSERT INTO "kexi__objects" VALUES(4, 3, 'persons', 'Persons in our company', NULL);
INSERT INTO "kexi__objects" VALUES(65, 3, 'cars', 'Cars', NULL);
INSERT INTO "kexi__objects" VALUES(96, 4, 'report', 'Report', NULL);
INSERT INTO "kexi__objects" VALUES(101, 5, 'write_simple_text_report', 'Write simple text report', NULL);
INSERT INTO "kexi__objects" VALUES(103, 1, 'ownership', 'Ownership', NULL);
INSERT INTO "kexi__objects" VALUES(104, 2, 'persons_and_cars', 'Persons and cars', NULL);
INSERT INTO "kexi__objects" VALUES(105, 3, 'ownership', 'Ownership', NULL);
INSERT INTO "kexi__objects" VALUES(106, 7, 'open_cars_and_go_to_last', 'Open cars and go to the last row', NULL);
INSERT INTO "kexi__objects" VALUES(107, 2, 'persons_by_age', 'Persons by age', NULL);
CREATE TABLE kexi__parts (p_id INTEGER PRIMARY KEY, p_name Text(200), p_mime Text(200), p_url Text(200));
INSERT INTO "kexi__parts" VALUES(1, 'Tables', 'kexi/table', 'http://koffice.org/kexi/');
INSERT INTO "kexi__parts" VALUES(2, 'Queries', 'kexi/query', 'http://koffice.org/kexi/');
INSERT INTO "kexi__parts" VALUES(3, 'Formularze', 'kexi/form', 'http://koffice.org/kexi/');
INSERT INTO "kexi__parts" VALUES(4, 'Reports', 'kexi/report', 'http://www.koffice.org/kexi/');
INSERT INTO "kexi__parts" VALUES(5, 'Scripts', 'kexi/script', 'http://www.koffice.org/kexi/');
INSERT INTO "kexi__parts" VALUES(7, 'Macros', 'kexi/macro', 'http://www.koffice.org/kexi/');
CREATE TABLE kexi__querydata (q_id UNSIGNED Integer, q_sql CLOB, q_valid Boolean);
CREATE TABLE kexi__queryfields (q_id UNSIGNED Integer, f_order Integer, f_id Integer, f_tab_asterisk UNSIGNED Integer, f_alltab_asterisk Boolean);
CREATE TABLE kexi__querytables (q_id UNSIGNED Integer, t_id UNSIGNED Integer, t_order UNSIGNED Integer);
CREATE TABLE persons (id INTEGER PRIMARY KEY, age UNSIGNED Integer, name Text(200), surname Text(200));
INSERT INTO "persons" VALUES(1, 32, 'Georege', 'Foster');
INSERT INTO "persons" VALUES(2, 62, 'Joan', 'Shelley');
INSERT INTO "persons" VALUES(3, 51, 'William', 'Gates ™');
INSERT INTO "persons" VALUES(4, 45, 'John', 'Smith');
INSERT INTO "persons" VALUES(10, 58, 'Александр', 'Пушкин');
INSERT INTO "persons" VALUES(12, 79, 'Μιχαήλ', 'Στεφανόπουλος');
CREATE TABLE kexi__blobs (o_id INTEGER PRIMARY KEY, o_data BLOB, o_name Text(200), o_caption Text(200), o_mime Text(200) NOT NULL, o_folder_id Integer UNSIGNED);
INSERT INTO "kexi__blobs" VALUES(1, X'[encoded data, 10456 characters]', 'blockdevice.png', 'blockdevice', 'image/png', 0);
INSERT INTO "kexi__blobs" VALUES(3, X'[encoded data, 10052 characters]', 'kuser.png', 'kuser', 'image/png', 0);
INSERT INTO "kexi__blobs" VALUES(4, X'[encoded data, 28922 characters]', 'folder_yellow.png', 'folder yellow', 'image/png', 0);
INSERT INTO "kexi__blobs" VALUES(5, X'[encoded data, 28922 characters]', 'folder_yellow.png', 'folder yellow', 'image/png', 0);
CREATE TABLE cars (id INTEGER PRIMARY KEY, model Text(200));
INSERT INTO "cars" VALUES(1, 'Fiat');
INSERT INTO "cars" VALUES(2, 'Syrena');
INSERT INTO "cars" VALUES(3, 'Chrysler');
INSERT INTO "cars" VALUES(4, 'Volvo');
INSERT INTO "cars" VALUES(5, 'BMW');
CREATE TABLE ownership (id INTEGER PRIMARY KEY, owner Integer, car Integer, since Integer);
INSERT INTO "ownership" VALUES(1, 1, 1, 2004);
INSERT INTO "ownership" VALUES(2, 2, 2, 1982);
INSERT INTO "ownership" VALUES(3, 3, 3, 2002);
INSERT INTO "ownership" VALUES(4, 4, 4, 2005);
INSERT INTO "ownership" VALUES(5, 10, 4, 2006);
INSERT INTO "ownership" VALUES(6, 4, 1, 2003);
INSERT INTO "ownership" VALUES(7, 12, 3, 1999);
COMMIT;
