Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Other SQL Server 2008 Topics
 SQL server low level API's

Author  Topic 

abhijitbanerjee
Starting Member

1 Post

Posted - 2008-08-05 : 06:19:25
We are migrating from existing database(rdm, (http://www.raima.com/)) to SQL Server 2008 and want to use odbc feature as the existing code is written using it. We are using C as the programming language.
 
The existing database(RDM) provides low level API's to query to the database like select, insert ,update, delete etc. Does SQL Server 2008 provides such a feature where we can use low level API's ( and not SQL Statements like "Select * from table") to query to the database.
 
Let me substantiate this with an example ,
 
following example shows quering a column in SQL Server 2008
 
 
 retcode = SQLExecDirect(hstmt1, (UCHAR*)"SELECT AGE FROM AdventureWorks.dbo.emp3", SQL_NTS); 
 while (SQL_SUCCESS == SQLFetch(hstmt1))
 { 
  if ( (retcode = SQLGetData(hstmt1, 1, SQL_C_LONG, &Data, 0, &cbTxtSize)) != SQL_NO_DATA) {
   printf("GetData iteration %d, pcbValue = %d,\n", cntr++, cbTxtSize);
   printf("Data = %d\n\n", Data);
}
 

 
same example in rdm(Existing Database):

// loop from first record, till all records are traversed
for (stat = d_recfrst(emp3, HANDLETOTHEDATABSE); stat == S_OKAY; stat = d_recnext( HANDLETOTHEDATABSE) ) {
 
//read AGE column from table and store the result in returnValue param
d_crread(AGE, &returnValue,  HANDLETOTHEDATABSE);
 
//do something
}
 
Here we are using the statement "SELECT AGE FROM AdventureWorks.dbo.emp3"  to query the database. Is there any low level api's using which we can query the database in SQL Server 2008.

Abhijit Banerjee

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2008-08-06 : 02:00:06
the only supported way to get data from SQL Server is with a T-SQL query.


elsasoft.org
Go to Top of Page
   

- Advertisement -