Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
KSQL_STMT_ALLOC(3)	    Library Functions Manual	    KSQL_STMT_ALLOC(3)

NAME
       ksql_stmt_alloc -- allocate a statement on a database connection

LIBRARY
       library "ksql"

SYNOPSIS
       #include	<sys/types.h>
       #include	<stdint.h>
       #include	<ksql.h>

       enum ksqlc
       ksql_stmt_alloc(struct ksql *sql,	       struct ksqlstmt **stmt,
	   const char *sqlstmt,	size_t id);

DESCRIPTION
       The ksql_stmt_alloc function allocates a	SQL  statement	sqlstmt	 on  a
       database	 connection  sql previously opened with	ksql_open(3).  It must
       be matched by a call to ksql_stmt_free(3).   Upon  success,  this  will
       fill  in	the stmt pointer.  The id is used to identify the statement in
       error messages and should uniquely identify the statement.

       If a non-empty cfg->stmts structure documented in  ksql_cfg_defaults(3)
       is passed to ksql_alloc(3) or ksql_alloc_child(3), the stored statement
       is  looked  up  by id and the sqlstmt value is ignored.	If id is not a
       valid index of cfg->stmts.stmtsz	or if the current role does not	permit
       access to the statement,	an error message is emitted on stderr and  the
       program is immediately terminated.

       The  ksql_stmt_alloc  function handles a	locked database	(specifically,
       SQLITE_BUSY, SQLITE_LOCKED, or SQLITE_PROTOCOL) by sleeping for a  ran-
       dom interval, then trying again infinitely.

RETURN VALUES
       This  returns KSQL_MEM on allocation failure, KSQL_NOTOPEN if the data-
       base  isn't  connected,	or  KSQL_DB  if	 there	were  errors  invoking
       sqlite3_prepare_v2(3), otherwise	KSQL_OK	on success.

SEE ALSO
       sqlite3_prepare_v2(3)

FreeBSD	Ports 14.quarterly	 April 5, 2018		    KSQL_STMT_ALLOC(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=ksql_stmt_alloc&sektion=3&manpath=FreeBSD+Ports+14.3.quarterly>

home | help