Sean,

Gotcha! Thanks for the help. It is greatly appreciated.

Regards,
Kirt

2006/2/18, Sean Arney <[EMAIL PROTECTED]>:
>
> > Looking further into your earlier post. .... so FieldSchema returns the
> > attributes of a single field? And tableschema returns a list of all
> tables?
> > How do we test if one or multiple fields exists within a table or not?
> In
> > the snippet below "Note" is a table, not a field.
> >
> No, FieldSchema is going to return the 5 field attributes listed
> previously
> for all the fields in the table its called on.
>
> TableSchema returns the names of the tables in the db when you call
> db.TableSchema, so you would loop the rset and return true when you found
> the table name you were looking for.
>
> Likewise, calling d.FieldSchema(table) returns the field data in 5 part
> form
> for that table.  So then you would loop on the rset checking FieldIndex( 1
> ).StringValue to see if the columnName you are checking for is a
> match.  If
> so, return true:
>
>   dim tname as string
>   dim result as boolean
>   dim rset as RecordSet
>   Dim s As String
>
>   rset = db.FieldSchema( colname )
>   If rset <> Nil And Not rset.EOF Then
>     If isTable Then return True
>     rset.MoveFirst
>     While Not rset.EOF
>       s = rset.IdxField( 1 ).StringValue
>       If s = "columnNameImLookingFor" then
>         return True
>       End If
>       rset.MoveNext
>     Wend
>   End If
>
>   return result
>
> Of course s is not necessary but its nice to see it!  Remove it for actual
> use.  It might not be Kosher, but when Im looking for table exists, I use
> that 'isTable' bool in the call and then the rset will be Nil so we know
> it
> doesn't exist.  Also the MoveFirst is not necessary but I am weird that
> way.
> I bet it slows it down some miniscule amount.
>
> -seanA
>
>
>
> _______________________________________________
> 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>
>



--
Kirt Cathey
WorkPapers Development
_______________________________________________
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>

Reply via email to