text: /** 
   * Copyright (c) 2017 SQLines
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *   http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  // SqlStdApi Standard Output API
  
  #ifndef sqlines_sqlstdapi_h
  #define sqlines_sqlstdapi_h
  
  #if defined(WIN32) || defined(_WIN64)
  #include <windows.h>
  #endif
  
  #include "sqlapibase.h"
  #include "sqldb.h"
  
  class SqlStdApi : public SqlApiBase
  {
  public:
  	SqlStdApi();
  	~SqlStdApi();
  
  	// Initialize API
  	virtual int Init();
  
  	// Set additional information about the driver type
  	virtual void SetDriverType(const char *info);
  
  	// Set the connection string in the API object
  	virtual void SetConnectionString(const char *conn);
  
  	// Connect to the database
  	virtual int Connect(size_t *time_spent);
  
  	// Get row count for the specified object
  	virtual int GetRowCount(const char *object, int *count, size_t *time_spent);
  
  	// Execute the statement and get scalar result
  	virtual int ExecuteScalar(const char *query, int *result, size_t *time_spent);
  
  	// Execute the statement
  	virtual int ExecuteNonQuery(const char *query, size_t *time_spent);
  
  	// Open cursor and allocate buffers
  	virtual int OpenCursor(const char *query, size_t buffer_rows, int buffer_memory, size_t *col_count, size_t *allocated_array_rows, 
  		int *rows_fetched, SqlCol **cols, size_t *time_spent, bool catalog_query = false,
          std::list<SqlDataTypeMap> *dtmap = NULL);
  
  	// Fetch next portion of data to allocate buffers
  	virtual int Fetch(int *rows_fetched, size_t *time_spent);
  
  	// Close the cursor and deallocate buffers
  	virtual int CloseCursor();
  
  	// Initialize the bulk copy from one database into another
  	virtual int InitBulkTransfer(const char *table, size_t col_count, size_t allocated_array_rows, SqlCol *s_cols, SqlCol **t_cols);
  
  	// Transfer rows between databases
  	virtual int TransferRows(SqlCol *s_cols, int rows_fetched, int *rows_written, size_t *bytes_written,
  		size_t *time_spent);
  
  	// Specifies whether API allows to parallel reading from this API and write to another API
  	virtual bool CanParallelReadWrite();
  
  	// Complete bulk transfer
  	virtual int CloseBulkTransfer();
  
  	// Drop the table
  	virtual int DropTable(const char* table, size_t *time_spent, std::string &drop_stmt);
  	// Remove foreign key constraints referencing to the parent table
  	virtual int DropReferences(const char* table, size_t *time_spent);
  
  	// Get the length of LOB column in the open cursor
  	virtual int GetLobLength(size_t row, size_t column, size_t *length);
  	// Get LOB content
  	virtual int GetLobContent(size_t row, size_t column, void *data, size_t length, int *len_ind);
  	// Get partial LOB content
  	virtual int GetLobPart(size_t row, size_t column, void *data, size_t length, int *len_ind);
  	
  	// Get the list of available tables
  	virtual int GetAvailableTables(std::string &select, std::string &exclude, std::list<std::string> &tables);
  
  	// Read schema information
  	virtual int ReadSchema(const char *select, const char *exclude, bool read_cns = true, bool read_idx = true);
  
  	// Read specific catalog information
  	virtual int ReadConstraintTable(const char *schema, const char *constraint, std::string &table);
  	virtual int ReadConstraintColumns(const char *schema, const char *table, const char *constraint, std::string &cols);
  
  	// Build a condition to select objects from the catalog
  	virtual void GetCatalogSelectionCriteria(std::string &selection_template, std::string &output);
  
  	// Get database subtype
  	virtual short GetType() { return SQLDATA_STDOUT; }
  	virtual short GetSubType() { return 0; }
  };
  
  #endif // sqlines_sqlstdapi_h