On Saturday 24 January 2009, Randy wrote:
> .Fields.Add("status", gb.String, 1)
> .PrimaryKey = ["account"]
> .Indexes.Add("glcoa_sort", "glsort", TRUE)
> .Update
> END WITH
>
> Here's the debug output with index. Their is NO CREATE TABLE SQL when you try
> make table with indexes. It's missing! It looks like this is a bug in Gambas
> when creating table with indexes.
>
> postgresql: 0x8159aa8: select substring(version(),12,5)
> postgresql: 0x8159aa8: show client_encoding
> postgresql: 0x8159aa8: select relname from pg_class where (relkind = 'r'
> or relkind = 'v') and (relname = 'glcoa') and (relnamespace not in
> (select oid from pg_namespace where nspname = 'information_schema'))
> postgresql: 0x8159aa8: select pg_class.relname from pg_class, pg_index,
> pg_class pg_class2 where pg_class2.relname = 'glcoa' and
> (pg_class2.relnamespace not in (select oid from pg_namespace where
> nspname = 'information_schema')) and pg_index.indrelid = pg_
> class2.oid and pg_index.indexrelid = pg_class.oid and pg_class.relname =
> 'glcoa_sort'
> postgresql: 0x8159aa8: CREATE UNIQUE INDEX "glcoa_sort" ON glcoa ( glsort )
------------------------------------------------------------^^^^^^^
here it tries the table glcoa but that does not exist yet !!!
>
OK
Just the last line tells me it wants a table to add the index.
>From the past with msaccess and mysql i had a problem too
The solution was write the table first and change the field type.
For the last line I would say it try to create the index "glcoa_sort" ON glcoa
and that the table glcoa does not exist.
suggest:
a)
.Fields.Add("status", gb.String, 1)
.PrimaryKey = ["account"]
.Update '<-- this should write the table before tha add indexes
.Indexes.Add("glcoa_account", "account", TRUE)
.Indexes.Add("glcoa_sort", "glsort", TRUE)
.Update
END WITH
or
b)
.Fields.Add("status", gb.String, 1)
.PrimaryKey = ["account"]
.Update
END WITH
' here the table must have been written by the .update and the END WIDTH
' maybe you must reopen the table again here
WITH hTable
.Indexes.Add("glcoa_account", "account", TRUE)
.Indexes.Add("glcoa_sort", "glsort", TRUE)
.Update '<-- this should write the table before tha add indes
END WITH
It looks stupid but it is the best idea I have ATM.
Best regards,
Ron_1st
--
------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Gambas-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gambas-user