<doc>
  <legacy_id>2344</legacy_id>
  <name>revDatabaseColumnNames</name>
  <type>function</type>
  <syntax>
    <example>revDatabaseColumnNames(<i>recordSetOrConnectionId </i>[,<i> tableName </i>])</example>
  </syntax>
  <library>Database library</library>
  <objects>
  </objects>
  <synonyms>
    <synonym>revdb_columnnames</synonym>
  </synonyms>
  <classification>
    <category>Database Operations</category>
    <category>Standalone Applications</category>
  </classification>
  <references>
    <function tag="revDatabaseColumnIsNull">revDatabaseColumnIsNull Function</function>
    <function tag="revDatabaseColumnNamed">revDatabaseColumnNamed Function</function>
    <function tag="revDatabaseColumnCount">revDatabaseColumnCount Function</function>
    <function tag="revDatabaseColumnTypes">revDatabaseColumnTypes Function</function>
  </references>
  <history>
    <introduced version="1.1">Added.</introduced>
    <changed version="2.9"></changed>
  </history>
  <platforms>
    <mac/>
    <windows/>
    <linux/>
    <ios/>
    <android/>
  </platforms>
  <classes>
    <desktop/>
    <server/>
    <web/>
    <mobile/>
  </classes>
  <security>
    <disk access="???"/>
    <network/>
  </security>
  <summary><glossary tag="return">Returns</glossary> the list of <glossary tag="database field">database field</glossary> names in a <glossary tag="record set (database cursor)">record set (database cursor)</glossary> or a database table</summary>
  <examples>
    <example>revDatabaseColumnNames(foundResults)</example>
    <example>get revDatabaseColumnNames(field "Current Results")</example>
    <example>get revDatabaseColumnNames(tConnectionId, "myTable")</example>
  </examples>
  <description>
    <p>Use the <b>revDatabaseColumnNames</b> <control_st tag="function">function</control_st> to find out what <glossary tag="database field">database fields</glossary> are in the <glossary tag="record set (database cursor)">record set</glossary> returned by a <glossary tag="SQL query">SQL query</glossary> or what database fields are contained within a certain table.</p><p/><p><b>Parameters:</b></p><p>The <i>recordSetOrConnectionId</i>  is either the number returned by the <function tag="revQueryDatabase">revQueryDatabase</function> when the record set was created or the number returned by the <function tag="revOpenDatabase">revOpenDatabase function</function> when the connection was created.</p><p/><p>The <i>tableName</i> is the name of a table in the current database. A table name should be specified if the <i>recordSetOrConnectionId</i> parameter is a connection id.</p><p/><p><b>Value:</b></p><p>The <b>revDatabaseColumnNames</b> <control_st tag="function">function</control_st> returns a list of <glossary tag="database field">database field</glossary> names, separated by commas.</p><p/><p><b>Comments:</b></p><p>There are two forms of the revDatabaseColumnNames function. It can either be used to return the list of column names in a record set, or as of version 2.9, the list of columns in a given table. </p><p/><p>To get the list of columns in a record set use a form like this:</p><p/><p>get revDatabaseColumnNames(tRecordSetId)</p><p/><p>To get the list of columns in a given table, use a form like this:</p><p/><p>get revDatabaseColumnNames(tConnectionId, "myTable")</p><p/><p>If the operation is not successful, the <b>revDatabaseColumnNames</b> <control_st tag="function">function</control_st> returns an error message that begins with the <keyword tag="string">string</keyword> "revdberr".</p><p/><p><img src="202653"/> <b>Important!</b> The <b>revDatabaseColumnNames</b> <control_st tag="function">function</control_st> is part of the <glossary tag="Database library">Database library</glossary>. To ensure that the <control_st tag="function">function</control_st> works in a <glossary tag="standalone application">standalone application</glossary>, you must include this <glossary tag="LiveCode custom library">custom library</glossary> when you create your <glossary tag="standalone application">standalone</glossary>. In the Inclusions section of the General screen of the <glossary tag="Standalone Application Settings">Standalone Application Settings</glossary> window, make sure the "Database Support" checkbox is checked and the database drivers you are using are selected in the list of database drivers.</p><p/><p><b>Changes:</b></p><p>The ability to obtain the list of fields for a table without obtaining a record set first was added in version 2.9</p><p>The <b>revDatabaseColumnNames</b> synonym was added in version 2.0.</p>
  </description>
</doc>