Title: MBS908:Building DataDriven AvantGo Applications
1MBS908Building Data-Driven AvantGo Applications
David KlobaSenior Manager, Software Engineer
Developmentklobad_at_sybase.comAugust 7th, 2003
2Overview
- Architecture
- XML Conduit
- AvantGo Database POD
- Example - Simple
- Example - Full
- Miscellaneous
- Q A
3Architecture Overview
4Architecture Overview
5XML Conduit Overview
- What is it?
- Another conduit that runs inside the AvantGo
M-Business Server Application Edition - Configured much the same way a regular channel
is, has a data url and a schema url - Makes http requests for the urls, expects XML and
XMLSchema documents instead of html documents - Currently the conduit is effectively read-only,
it makes requests for data, but does not push
data - Currently most developers are handling changes
through normal html form submissions - It expects the responses to be the full data set,
and will only send changes or deletes to the
device - Expects a single field to be the PrimaryKey,
doesnt support compound keys
6XML Conduit Overview
Continued
7XML Conduit Overview
Continued
8XML Conduit Overview
Continued
- How do I tell the conduit what columns are in my
table?
lt?xml version"1.0" encoding"UTF-8"
standalone"no"?gt ltxsdschema xmlnsxsd"http//ww
w.w3.org/2001/XMLSchema" xmlnsdt"urnschemas-mi
crosoft-comdatatypes" xmlnsmsch"urnschemas-mi
crosoft-commapping-schema"gt ltxsdelement name"Da
taRecord" mschrelation"DataRecord" type"DataT
ype"/gt ltxsdcomplexType name"DataType"gt ltxsdatt
ribute name"int32Field" type"xsdint"/gt ltxsda
ttribute name"uint32Field" type"xsdunsignedInt
"/gt ltxsdattribute name"int16Field"
type"xsdshort"/gt ltxsdattribute
name"uint16Field" type"xsdunsignedShort"/gt ltx
sdattribute name"stringField"
type"xsdstring"/gt ltxsdattribute
name"dateField" type"xsddateTime"/gt ltxsdattr
ibute name"stringNField" gt ltxsdsimpleTypegt
ltxsdrestriction base"xsdstring"gt ltxsdmaxLeng
th value"32"/gt lt/xsdrestrictiongt
lt/xsdsimpleTypegt lt/xsdattributegt ltxsdattribute
name"booleanField" type"xsdboolean"/gt ltxsda
ttribute name"timeField" type"xsddateTime"/gt
ltxsdattribute name"int32Field2"
type"xsdint"/gt ltxsdkey name"PrimaryKey"gt lt
xsdselector xpath"."/gt ltxsdfield
xpath"_at_int32Field"/gt lt/xsdkeygt lt/xsdcomplexTyp
egt lt/xsdschemagt
9XML Conduit Overview
Continued
- How do I tell the conduit what data is in my
table?
lt?xml version"1.0" encoding"iso-8859-1"
?gt ltrootgt ltDataRecord int32Field"1025" uint32F
ield"1027" int16Field"1028" uint16Field"102
6" stringField"string1" dateField"Mon, 26
Dec 1994 000100 GMT" stringNField"FixedString
1" booleanField"TRUE" timeField"Mon, 26 Dec
1994 000100 GMT" int32Field2"1025" /gt ltDat
aRecord int32Field"1026" uint32Field"1028" i
nt16Field"1029" uint16Field"1027" stringFiel
d"string2" dateField"Mon, 26 Dec 1994
000200 GMT" stringNField"FixedString2" bool
eanField"FALSE" timeField"Mon, 26 Dec 1994
000200 GMT" int32Field2"1026" /gt lt/rootgt
10Architecture Overview
11AvantGo Database POD Overview
- What is it?
- A POD is simply a plugin to the AvantGo client
- A simple ADO like api accessible from JavaScript
to manipulate the databases - Standard methods to add / change / delete /
filter / sort the data within a database on the
device - Supports float, int, string, boolean, and date
types - Straight forward cursor based api, you have a
current row, all actions apply to that row - Simple search and sort functions. Lightweight
implementations - weve been using it in production applications
for over a year
12AvantGo Database POD Overview
Continued
- How do I get one and work with it?
function DoSomethingInteresting() var dbMgr
CreateObject("avantgo.db") var dbSet dbSet
dbMgr.open("test", "w") dbSet.addNew() dbSet.
int32Field 123 dbSet.stringField "new
string record" dbSet.commit() dbSet.close()
13AvantGo Database POD Overview
API Review AGDBDatabaseManager
interface AGDBDatabaseManager AGDBObject
readonly attribute AGDBColumnTypes types
AGDBNewMetadata createMetadata() boolean
create( String dbname, AGDBMetadata metadata,
String flags) void remove( String dbname)
boolean exists( String dbname) AGDBSet
open( String dbname, String flags)
14AvantGo Database POD Overview
API Review - AGDBSet
interface AGDBSet AGDBObject readonly
attribute unsigned long nrows readonly
attribute unsigned long index readonly
attribute AGDBMetadata metadata boolean
moveTo(unsigned long index) boolean
moveBy(long numRecords) boolean
moveFirst() boolean moveLast() boolean
moveNext() boolean movePrev() /These are
all valid JavaScript examples of search
criteria search myDBSet.createSearch("startDat
e gt " myDate) search myDBSet.createSearch("s
tartDate gt " myDate.getTime()) search
myDBSet.createSearch("address like park
lane") search myDBSet.createSearch("name
'David'") search myDBSet.createSearch("city
Chicago") search myDBSet.createSearch("zipcode
gt 90302") search myDBSet.createSearch("hasPaid
true") search myDBSet.createSearch("city
Chicago")/ AGDBSearch createSearch(in
String criteria) boolean find(AGDBSearch
search) boolean atbof() boolean
ateof() boolean rowDeleted() boolean
rowUpdated()
15AvantGo Database POD Overview
API Review AGDBSet continued
interface AGDBSet AGDBObject .
void addNew() void deleteRow() // Marks
record deleted void removeRow() //
Completely deletes row from db void
undo() void commit() void close()
boolean getBooleanField( String name)
PODSDate getDateField( String name)
long getInt32Field( String name)
unsigned long getUInt32Field( String name)
short getInt16Field( String name)
unsigned short getUInt16Field( String name)
String getStringField( String name)
PODSDouble getDoubleField( String name)
void setBooleanField( String name,
boolean value) void setDateField(
String name, PODSDate value) void
setInt32Field( String name, long value) void
setUInt32Field( String name, unsigned
long value) void setInt16Field(
String name, short value) void
setUInt16Field( String name, unsigned short
value) void setStringField( String
name, String value) void
setDoubleField( String name, PODSDouble value)
16AvantGo Database POD Overview
API Review
void setFilter(AGDBSearch) void
filterDeletedRecords(boolean filter) void
setSort( String columnName, boolean
sortAscending) boolean isFieldNull( String
name) void setFieldNull( String
name) interface AGDBMetadata AGDBObject
readonly attribute unsigned long ncolumns
String getColumnName( unsigned long index)
short getColumnType( unsigned long index)
long getColumnSize( unsigned long index)
long getColumnIndex( String name) long
getNullable( unsigned long index) interface
AGDBNewMetadata AGDBMetadata void
appendColumn( String name, short type, unsigned
long stringn_size) void setNullable(
unsigned long index, long isNullable) interface
AGDBColumnTypes AGDBObject readonly
attribute short BOOLEAN readonly attribute
short DATE readonly attribute short INT16
readonly attribute short UINT16 readonly
attribute short INT32 readonly attribute
short UINT32 readonly attribute short
STRING readonly attribute short STRINGN
readonly attribute short DOUBLE
17Simple Example
- Alright already, lets see this thing!
18Full Example
- That was pretty boring, how about something with
a little more pizzaz.
19Q A
Main Developer Site http//developer.avantgo.com
Developer Guide http//www.avantgo.com/doc/develo
per/apps/js_pods_guide/index.html
20iAnywhere Solutions at TechWave2003
Activities for iAnywhere Solutions
- Ask the iAnywhere Experts on the Technology
Boardwalk - Drop in during exhibit hall hours and have all
your questions answered by our technical experts! - Appointments outside of exhibit hall hours are
also available to speak one-on-one with our
Senior Engineers. Ask questions or get your
yearly technical review ask us for details - m-Business Pavilion
- Visit the m-Business Pavilion in the exhibit hall
to see how companies like Intermec have built
m-Business solutions using iAnywhere Solutions
technology - Wi-Fi Hotspots brought to you by Intel
iAnywhere Solutions - You can enjoy wireless internet access via a
Wi-Fi hotspot provided by Intel and iAnywhere
Solutions. Using either a laptop or PDA that is
Wi-Fi 802.11b wirelessly-enabled, visitors can
access personal email, the internet ,and
"TechWave To Go", a My AvantGo channel providing
up-to-date information about TechWave classes,
events and more.
21iAnywhere Solutions at TechWave2003
Activities for iAnywhere Solutions
- Developer Community
- A one-stop source for technical information!
- Access to newsgroups,new betas and code samples
- Monthly technical newsletters
- Technical whitepapers,tips and online product
documentation - Current webcast,class,conference and seminar
listings - Excellent resources for commonly asked questions
- All available express bug fixes and patches
- Network with thousands of industry experts
- http//www.ianywhere.com/developer/