I am trying to use a REALBasic data base for the first time
in my life.
I have succeeded in creating the data base and putting some
records into it using the following code once for each
record:
// Enter record into Table ExpandedEnglishWords
ExpandedEnglishWordsRec = New DatabaseRecord
ExpandedEnglishWordsRec.Column("TheWord") = Word
ExpandedEnglishWordsRec.Column("Abbreviation") = Abbreviation
ExpandedEnglishWordsRec.Column("Pshort") = Pshort
EnglishDictDB.InsertRecord "ExpandedEnglishWords",ExpandedEnglishWordsRec
EnglishDictDB.Commit
// Enter a new record into OneEntryForEachWord
OneEntryForEachWordRec = New DatabaseRecord
OneEntryForEachWordRec.Column("TheWord") = Word
OneEntryForEachWordRec.Column("QuickAskCount") = "0"
OneEntryForEachWordRec.Column("FAQCount") = "0"
OneEntryForEachWordRec.Column("QueryCount") = "0"
EnglishDictDB.InsertRecord "OneEntryForEachWord",OneEntryForEachWordRec
EnglishDictDB.Commit
That seems to have worked OK, the database looks like it
should when I use the "Browse" functionality of REALBasic.
When I try to look at the database, I tried to execute
the following two statements:
// First test statement
SelectedRecords = EnglishDictDB.SQLSelect("SELECT * FROM
OneEntryForEachWord WHERE TheWord='$addiction'")
EnglishDictDB.Commit
// SEcond test statement
SelectedRecords = EnglishDictDB.SQLSelect("SELECT * FROM
OneEntryForEachWord WHERE TheWord='afraid'")
EnglishDictDB.Commit
This did not work. After execution of the first test
statements above, when I look at "SelectedRecords" it says
Name Value
BOF False
EOF False
FieldCount 4
Does this mean that no data was found? How can I get the
contents of the record retrived with the SQLSelect
statement? The REALBasic User guide is rather vague about
how to get the contents of a retrieved record.
When I then continue with execution of the second test
statements above, the application crashes!
Question 1: What did I do wrong so that the first test
statement did not return the contents of the record. I know
that there is a record where "TheWord" has the value
"$addiction".
Question 2: Why did the program crash when I tried to
execute the second test statement?
Question 3: I have entered into the data base more than one
record with "TheWord" = "$addiction". But there only seems
to be one such record in the data base. Why? Is there some
rule that there can only be one record in the data base
with a certain value of an indexed attribute? It works OK
to have the same value in other fields, only not in the
TheWord field, which makes me believe that an indexed field
mmust have unique values, not the same value more than once.
Question 4: How does one debug SQL statements? REALBasic
has a very good debugger for ordinary code, but for data
bases there does not seem to be any debugger - just
crashing the execution as happended to me does not help
very much in explaining what went wrong!
Question 5: The subchapter "Editing Records" in the User
guide does not contain any examples. If there had been an
example, I might have learnt more how to do and maybe
myself understood what I did wrong. Is there any guide to
REALBasic data bases which does contain examples?
--
Jacob Palme <[EMAIL PROTECTED]> (Stockholm University and KTH)
for more info see URL: http://www.dsv.su.se/jpalme/
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>