Skip to content

Commit

Permalink
Make small functions derived from C macros templates so they don't re…
Browse files Browse the repository at this point in the history
…quire linking with ODBC
  • Loading branch information
andralex committed Jun 10, 2015
1 parent e37343b commit 6b52702
Showing 1 changed file with 57 additions and 64 deletions.
121 changes: 57 additions & 64 deletions etc/c/odbc/sqlext.d
Expand Up @@ -1555,70 +1555,63 @@ enum
SQL_SETPOS_MAX_LOCK_VALUE = SQL_LOCK_UNLOCK
}

version(unittest)
{
// no "macros" because they cause linking errors
}
else
{
//************************
/+ Macros for SQLSetPos +/
//************************
int SQL_POSITION_TO
(
SQLHSTMT hstmt,
ushort irow
)
{
return SQLSetPos( hstmt, irow, SQL_POSITION, SQL_LOCK_NO_CHANGE );
};

int SQL_LOCK_RECORD
(
SQLHSTMT hstmt,
ushort irow,
bool fLock
)
{
return SQLSetPos( hstmt, irow, SQL_POSITION, fLock );
}

int SQL_REFRESH_RECORD
(
SQLHSTMT hstmt,
ushort irow,
bool fLock
)
{
return SQLSetPos( hstmt, irow, SQL_REFRESH, fLock );
}

int SQL_UPDATE_RECORD
(
SQLHSTMT hstmt,
ushort irow
)
{
return SQLSetPos( hstmt, irow, SQL_UPDATE, SQL_LOCK_NO_CHANGE );
}

int SQL_DELETE_RECORD
(
SQLHSTMT hstmt,
ushort irow
)
{
return SQLSetPos( hstmt, irow, SQL_DELETE, SQL_LOCK_NO_CHANGE );
}

int SQL_ADD_RECORD
(
SQLHSTMT hstmt,
ushort irow
)
{
return SQLSetPos( hstmt, irow, SQL_ADD,SQL_LOCK_NO_CHANGE );
}
//************************
/+ Macros for SQLSetPos. They're templates so they don't link in. +/
//************************
int SQL_POSITION_TO()
(
SQLHSTMT hstmt,
ushort irow
)
{
return SQLSetPos( hstmt, irow, SQL_POSITION, SQL_LOCK_NO_CHANGE );
};

int SQL_LOCK_RECORD()
(
SQLHSTMT hstmt,
ushort irow,
bool fLock
)
{
return SQLSetPos( hstmt, irow, SQL_POSITION, fLock );
}

int SQL_REFRESH_RECORD()
(
SQLHSTMT hstmt,
ushort irow,
bool fLock
)
{
return SQLSetPos( hstmt, irow, SQL_REFRESH, fLock );
}

int SQL_UPDATE_RECORD()
(
SQLHSTMT hstmt,
ushort irow
)
{
return SQLSetPos( hstmt, irow, SQL_UPDATE, SQL_LOCK_NO_CHANGE );
}

int SQL_DELETE_RECORD()
(
SQLHSTMT hstmt,
ushort irow
)
{
return SQLSetPos( hstmt, irow, SQL_DELETE, SQL_LOCK_NO_CHANGE );
}

int SQL_ADD_RECORD()
(
SQLHSTMT hstmt,
ushort irow
)
{
return SQLSetPos( hstmt, irow, SQL_ADD,SQL_LOCK_NO_CHANGE );
}

// * Column types and scopes in SQLSpecialColumns. *
Expand Down

0 comments on commit 6b52702

Please sign in to comment.