$createstatement and kStatementServerTable
Das Goravani
das at goravani.com
Fri Jan 12 17:41:08 EST 2018
$createstatement is undocumented, so I’m wondering what it does
kStatementServerTable is therefore also confusion
This code is from one of the sample applications "Contacts" in 8.1.3
The following seems convoluted given it’s to verify the existence of 1 table
Why have a for loop for one server table
Then the $search and $first and $line useage seems odd to me
Mainly wanna know what is $createstatement and kStatementServerTable
Just have to say, I’m not new, I’m an old developer, trying to learn SQL, starting out with how to logon, this is all part of logging on in the sample contacts app provided with the 8.1.3 Pro 90 day demo download of the SDK (convuluted sorry), trying to learn how to logon, now I see this which is making sure the database has the one table in it and it seems awfully convuluted, rrr, I’m not getting very far very fast, another sample does it an entirely different way, that’s ok, but adds to the confusion, factually my attempts to learn just how to logon have made me sad, I’ve spent days watching videos and studying sample apps and I can’t say I’m any closer to being able to write or have a good example of logging onto a database, which I wanna do in code, not using the browser’s helpful tricks, I wanna learn to code this stuff
This line of code
Do tSQLObj.$opencreate.$assign(kTrue) ;; create a new sqlite database if it does not exist
is VERY confusing to me because A. how does it know to create a SQLite DB out of all the choices possible, B. there is no path or name given, so how does it know what to name the new file or where to put it, do both default to "library name" and "Library path"
Do lTablesForAppList.$define(lTableName)
Do lTablesForAppList.$add("Contacts")<——————one table
Do tSQLObj.$getTables() Returns lDBTableList<——calls the code shown below
Calculate lTotal as lTablesForAppList.$linecount
For lNum from 1 to lTotal step 1<————————for loop?
Do lTablesForAppList.[lNum].$loadcols()
Do lDBTableList.$search(lDBTableList.TableOrViewName=lTableName)
Do lDBTableList.$first(kTrue)
If not(lDBTableList.$line)
Do lRow.$definefromsqlclass(con("s",lTableName))
Do lRow.$sessionobject.$assign(tSQLObj)
Do tSQLObj.$createTable(lRow) Returns lStatus
End If
End For
Do tSQLObj.$getTables() Returns lDBTableList
$getTables
; list all server tables
Do $cinst.$createstatement()
Do iStmtObj.$tables(kStatementServerTable)
Do $cinst.$fetchAll(lList)
Quit method lList
$createstatement()
Do $cinst.$newstatement(#CT) Returns iStmtObj
What is this iStmtObj, is it an Object, a list, it’s an object by definition in variables
I dont understand why it’s used to do this fetch, what did new statement put in it etc ????
Do iStmtObj.$fetch(pList,kFetchAll)
More information about the omnisdev-en
mailing list