sqlite_column_count

From Liberty Unleashed Wiki
Jump to: navigation, search
Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events
Note: This function requires the external module lu_sqlite.

This function returns the column count in the query result struct.

Syntax

  1. int sqlite_column_count( UserPointer result )

Arguments

Example

This will print the column count from the query when '/colcount' is typed into the server console.

  1.  
  2. function onScriptLoad()
  3. {
  4. LoadModule( "lu_sqlite" );
  5. pSQDatabase <- sqlite_open( "database.sqlite" );
  6. return 1;
  7. }
  8.  
  9. function onConsoleInput( szCommand, szText )
  10. {
  11. if ( szCommand == "colcount" )
  12. {
  13. local query = sqlite_query( pSQDatabase, "SELECT Foo FROM Bar WHERE FooBar='" + szText + "'" );
  14. if ( query ) print( "Column count - " + sqlite_column_count( query ) );
  15. }
  16.  
  17. return 1;
  18. }
  19.  

Notes

The function LoadModule and sqlite_open and sqlite_query and print and event onScriptLoad and onConsoleInput were used in this example. More info about them in the corresponding pages.

For a larger example, check the SQLite database example from the wiki tutorials.

Related Functions

These functions are provided by the official module lu_sqlite.

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox