Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Note
titleNote!

Failovers can be triggered by all errors that occur while connecting to the database or executing commands, not exclusively due to connection problems.

Please refer to Notes section on the Database Functions page for details on allowed database data type.

sqlPrepSelect

The sqlPrepSelect function is used when selecting data from database tables.

...

Anchor
sqlprepdynamicselect
sqlprepdynamicselect

sqlPrepDynamicSelect

The sqlPrepDynamicSelect function is used when selecting data from database tables with dynamically created SQL statements.

...

Info
titleExample - Using sqpPrepDynamicSelect


Code Block
final string EXT_REF_CONFIG = "Default.extrefprop";
string TABLE_KEY = externalReferenceGet(EXT_REF_CONFIG, "mytable");
consume {
        string sql = "select col2 from " + TABLE_KEY + " where col1=?";
        list <any> parameters = listCreate(any, myUDR.aValue);
        table tab = sqlPrepDynamicSelect(sql, parameters, "Default.myPrimaryDB", "Default.mySecondaryDB");
        if ( tab != null ) {
           if ( tableRowCount(tab) > 0 ) {
              debug("Found following value in col2:" + tableGet(tab, 0, 0));
           }
        }
        else {
           abort("Both primary and secondary database nodes are unavailable");
         }
}


sqlPrepUpdate

The sqlPrepUpdate function is used when updating or inserting data into a database table.

...