Virtual Table....
Charles Cohen
rwc1717 at shaw.ca
Sat Oct 25 20:29:23 CDT 2008
Hi Ruslan:
.....running RB2008r1 and OSX 10.5.4...
In V4RB 3.4 I create a virtual table.....using the code below
dim vA as VTable
vA =
adb.CreateTable("xmltmp",EVStorageType.kRam,EVTableKind.kTblTemporary)
call vA.CreateStringField("a",45)
call vA.CreateStringField("b",7)
call vA.CreateStringField("c",7)
call vA.CreateStringField("d",8)
call vA.CreateStringField("e",7)
call vA.CreateStringField("f",7)
call vA.CreateStringField("g",16)
call vA.CreateStringField("h",15)
call vA.CreateStringField("i",2)
call vA.CreateStringField("j",4)
call vA.CreateStringField("k",500)
call vA.CreateStringField("l",500)
if totalbase then
call vA.CreateStringField("m",1024)
end if
...then I use the following code to restore it...to my database..
fiXML
=Specialfolder.applicationData.Child(dataFolder).Child("charts.xml")
vA.LoadDump( fiXML,EVDumpType.kXML)
pbA.maximum = vA.RecordCount
resVal = vA.FirstRecord
for i = 0 to vA.Recordcount-1
pba.value = i
pba.refresh
if vA.StringField("a").Value <> "none" then
rs = Nil
rs = aDb.SQLSelect("select * from aEquity where equityIDA =
'"+vA.StringField("h").Value+"'",EVCursorLocation.kClientSide)
if rs.RecordCount = 0 then
aDb.aEq.SetBlank()
aDb.aEq.aDescript.value = vA.StringField("a").Value
aDb.aEq.aHigh.value = vA.StringField("b").Value
aDb.aEq.aLow.value = vA.StringField("c").Value
aDb.aEq.aTarg.value = vA.StringField("d").Value
aDb.aEq.aDivd.value = vA.StringField("e").Value
if totalbase then
aDb.aEq.aBuy.value = vA.StringField("f").Value
aDb.aEq.aNote.value = vA.StringField("m").Value
else
aDb.aEq.aBuy.value = "0"
end if
aDb.aEq.aPerf.value = vA.StringField("g").Value
aDb.aEq.aequityID.value = vA.StringField("h").Value
call aDb.aEq.Addrecord()
aDb.aEq.Flush()
end if
else
rs = Nil
rs = aDb.SQLSelect("select * from aPrice where priceIDA =
'"+vA.StringField("h").Value+"' and monthA =
'"+vA.StringField("i").Value+"' and yearA =
'"+vA.StringField("j").Value
+"'",EVCursorLocation.kServerSide,EVLockType.kReadWrite)
if rs.RecordCount = 0 then
aDb.aPrc.SetBlank()
aDb.aPrc.aMonth.value = val(vA.StringField("i").Value)
aDb.aPrc.ayear.value = val(vA.StringField("j").Value)
aDb.aPrc.aDayString.value = vA.StringField("k").Value
aDb.aPrc.aDayStringHL.value = vA.StringField("l").Value
aDb.aPrc.aPriceID.value = vA.StringField("h").Value
call aDb.aPrc.Addrecord()
aDb.aPrc.Flush()
end if
end if
resVal = vA.NextRecord
next
adb.DropTable(vA)
It worked flawlessly...
In V4RB 3.5.2 it crashes with the following report...@
vA.LoadDump( fiXML,EVDumpType.kXML)
Process: Charting Equities.debug [589]
Path: /Users/admin/Sites/Real Basic Projects/Graphing V3/
Charting Equities.debug.app/Contents/MacOS/Charting Equities.debug
Identifier: ???
Version: (1.0.0d0)
Code Type: PPC (Native)
Parent Process: launchd [100]
Date/Time: 2008-10-25 17:46:56.063 -0700
OS Version: Mac OS X 10.5.5 (9F33)
Report Version: 6
Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000000
Crashed Thread: 0
Thread 0 Crashed:
0 libvkernel_fat_release.dylib 0x04b0ca18
fbl::Dumpable_XML_Field::_XML_EndElementHandler(void*, unsigned short
const*) + 712
1 libvkernel_fat_release.dylib 0x04df1f68
doContent(XML_ParserStruct*, int, encoding const*, char const*, char
const*, char const**) + 3096
2 libvkernel_fat_release.dylib 0x04df23b0
contentProcessor(XML_ParserStruct*, char const*, char const*, char
const**) + 48
3 libvkernel_fat_release.dylib 0x04df2c78
doProlog(XML_ParserStruct*, encoding const*, char const*, char const*,
int, char const*, char const**) + 1324
4 libvkernel_fat_release.dylib 0x04df400c
prologProcessor(XML_ParserStruct*, char const*, char const*, char
const**) + 84
5 libvkernel_fat_release.dylib 0x04dedde0 XML_Parse + 188
6 libvkernel_fat_release.dylib 0x04b137ac
fbl::Dumper_XML::Do_LoadDump_UTF16(unsigned long, int) + 108
7 libvkernel_fat_release.dylib 0x04b13948
fbl::Dumper_XML::Do_LoadDump() + 132
8 libvkernel_fat_release.dylib 0x04b13a68
fbl::Dumper_XML::LoadDump(fbl::smart_ptr<fbl::I_Dumpable>) + 60
9 libvkernel_fat_release.dylib 0x04dd6848
fbl::Database_imp::LoadDumpTable(fbl::smart_ptr<fbl::I_TableEx>,
fbl::smart_ptr<fbl::I_Location>, unsigned char, char const*) + 728
10 libvkernel_fat_release.dylib 0x04dcd1a4
fbl::vsql::SqlDatabase::LoadDumpTable(fbl::smart_ptr<fbl::I_TableEx>,
fbl::smart_ptr<fbl::I_Location>, unsigned char, char const*) + 148
11 libvkernel_fat_release.dylib 0x04c4663c
fbl::Table::LoadDump(fbl::smart_ptr<fbl::I_Location>, unsigned char,
char const*) + 144
12 V4RB.rbx_0.dylib 0x04825a4c
Table_LoadDump(REALobjectStruct*, REALfolderItemStruct*, int,
REALstringStruct*) + 328
13 0x00313484 VTable.LoadDump%
%o<VTable>o<FolderItem>i4s + 132
14 0x007febf8
ArchiveWindow.ArchiveWindow.LoadXMLFile%
%o<ArchiveWindow.ArchiveWindow> + 20784
15 0x007e0f10
ArchiveWindow.ArchiveWindow.TBArchive1_Action%
(this is not the whole report..if you need it I can replicate it easily)
Is there a change in 3.5.2 from 3.4 regarding virtual tables?
I reverted to V4RB 3.4 and the code works fine.
Chuck
More information about the Valentina
mailing list