Creating new database table oddity
Ruslan Zasukhin
ruslan at paradigmasoft.com
Sun Jul 27 13:25:53 CDT 2008
On 7/13/08 7:43 PM, "Charles Cohen" <rwc1717 at shaw.ca> wrote:
Hi Charles,
> Hi Ruslan:
Sorry for delay. Just back from vacation.
Please send such questions to lists, you may get help much faster from our
team or Valentina gurus.
> I am using V4RB 3.5.2, rb2008v1, macOSX 10.5.2 and have noticed a
> starnge occurence when I test my code for adding a new table to the
> database....
> I create a tmpDB and change a few field characteristics and then I
> create the new table...
> f = Specialfolder.applicationData.Child(dataFolder).Child("charts.vdb")
> if f<> Nil then
> if f.exists then
> tmpDB = new VDataBase
> b =tmpDb.SqlExecute("set PROPERTY WarningMode to FALSE")
> tmpDB.Open( f )
> if tmpDB.SchemaVersion < 5 then
> BaseObject = tmpDB.Table("Equity")
> fld = BaseObject.Field("NoteDB")
> newFld = BaseObject.ChangeType(fld,EVFieldType.kTypeText,1024)
> pfld = BaseObject.StringField("PerfDB")
> pfld.MaxLength = 16
> tfld = BaseObject.StringField("TargDB")
> tfld.MaxLength = 8
> BaseObject = tmpDB.Table("Choices")
> sfld = BaseObject.StringField("SizeDB")
> sfld.maxlength = 13
> gfld = BaseObject.StringField("HolidayDB")
> gfld.maxlength = 13
>>>>>>>>>>>>>>>>>>>>>>>>>>>
> BaseObject = new VTable("Industry")
> ifld = BaseObject.CreateStringField("Descript",45)
> ifld = BaseObject.CreateStringField("Letter",1)
>>>>>>>>>>>>>>>>>>>>>>>>>>>
Wait.
So you want create new table in the ver5 ?
You need do this as BaseObject.CreateTable()
> tmpDB.SchemaVersion = 5
> tmpDB.Flush()
> tmpDb.close
> end if......
>
> For some reason another permanent VTable gets produced...it is called
> table_6....it has no fields...
> I have noticed that when viewing the database with VStudio that...the
> original 3 Tables were identified by
> ID 3, ID 4 and ID 5....and the new 'Industry' table got ID 7
> Workaround:
> After the above code is finished I open up the database for use with
> my app...and run
>
> BaseObject = myDB.Table("table_6")
> if BaseObject <> Nil then
> myDb.dropTable(BaseObject)
> end if
>
> This removes it:-).
>
> Any ideas of what is going on?
--
Best regards,
Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc
Valentina - Joining Worlds of Information
http://www.paradigmasoft.com
[I feel the need: the need for speed]
More information about the Valentina
mailing list