ELENESSKI GAMES
  • Home
  • Games
    • Worzzler
    • The Lost Tribes
  • Unity
    • Facade Generator for Archimatix
    • Elenesski Object Database
    • Generic Move Camera
    • Unity C# Library
  • SQLINQ
    • Change Log
    • Concepts >
      • Overview
      • The Patterns
      • Database & Factories
      • Working with Tables
      • Custom Queries
      • Lazy Loading
      • Units of Work
    • Video Tutorials
    • Getting Started
    • Code Examples >
      • Implementing Behavior
      • Finding Objects
      • Custom Searches
      • Converters and Transformers
      • Object Association Management
      • New Objects
      • Creating Database
      • Associating Objects
      • Deleting Objects
      • Validating Objects
      • Saving
    • Sample Model >
      • Tutorial Model
      • Table Classes Code
      • Domain Classes Code
      • Factories Code
    • OSX Developers
    • Bridge Building
    • External Websites
    • Class Documentation
  • Presentations
    • 3D Ship Design
  • Music
    • Jamendo (Main)
    • Blend
    • Sound Cloud
    • Mixcloud (DJ)
    • DJ Demos
  • YouTube

Executing Custom Queries

As powerful as this library is, there are sometimes situations where you need to execute a specialized SQL statement.  You can use this technique for selecting, inserting, updating and deleting rows.  In this example, we are showing how to SELECT from a database:

         public static IEnumerable<TableClassName > GetAll(string aQuery)
            foreach( TableClassName ROW in Repository.GetTemporaryDatabaseConnection()
                                       .Query<TableClassName>( "select * from TableClassName where Field like ?", new object[] { aQuery } ) ) {
                yield return ROW;
            }

When executing INSERT statements, expect one integer return of the OID.  For update statements, you will need a separate value for each "?" in your SQL statement.