MCPcopy Create free account
hub / github.com/MapServer/MapServer / columnName

Function columnName

mapmssql2008.c:296–331  ·  view source on GitHub ↗

Get columns name from query results */

Source from the content-addressed store, hash-verified

294
295/* Get columns name from query results */
296static int columnName(msODBCconn *conn, int index, char *buffer, int bufferLength)
297{
298 SQLRETURN rc;
299
300 SQLCHAR columnName[SQL_COLUMN_NAME_MAX_LENGTH + 1];
301 SQLSMALLINT columnNameLen;
302 SQLSMALLINT dataType;
303 SQLUINTEGER columnSize;
304 SQLSMALLINT decimalDigits;
305 SQLSMALLINT nullable;
306
307 rc = SQLDescribeCol(
308 conn->hstmt,
309 (SQLUSMALLINT)index,
310 columnName,
311 SQL_COLUMN_NAME_MAX_LENGTH,
312 &columnNameLen,
313 &dataType,
314 &columnSize,
315 &decimalDigits,
316 &nullable);
317
318 if (rc == SQL_SUCCESS || rc == SQL_SUCCESS_WITH_INFO)
319 {
320 if (bufferLength < SQL_COLUMN_NAME_MAX_LENGTH + 1)
321 strlcpy(buffer, (const char *)columnName, bufferLength);
322 else
323 strlcpy(buffer, (const char *)columnName, SQL_COLUMN_NAME_MAX_LENGTH + 1);
324 return 1;
325 }
326 else
327 {
328 setStmntError(conn);
329 return 0;
330 }
331}
332
333/* open up a connection to the MS SQL 2008 database using the connection string in layer->connection */
334/* ie. "driver=<driver>;server=<server>;database=<database>;integrated security=?;user id=<username>;password=<password>" */

Callers 1

msMSSQL2008LayerGetItemsFunction · 0.85

Calls 2

strlcpyFunction · 0.85
setStmntErrorFunction · 0.85

Tested by

no test coverage detected