Check out http://www.lazarusid.com/sqlite3 for a working example.

Clay Dowling

"Severin Müller" wrote:
> Hi
>
> I'm new to sqlite3, and i' have some Problems with my code. I'm trying to
> select data from a table and to save the result in a string. but i have no
> clue how to accomplish this.
>
> Here is a part of my code:
>
> std::string get_user_info(const char* nick,int mode)
> {
> #ifdef _WIN32
>       const char *filename = "db\\users.db";
> #else
>       const char *filename = "db/users.db";
> #endif
>       services serv;
>       Config conf;
>       sqlite3 *db;
>       char *zErrMsg = 0;
>       int rc;
>       char *sql = (char*) malloc(sizeof(char)*64);
>       rc = sqlite3_open(filename,&db);
>       if(rc)
>       {
>               std::cout << "S_ERR_USERDATABASE" << std::endl;
>               globops(conf.get_s_name(),S_MSG_SRVGOINGDOWN);
>               sqlite3_close(db);
>               return NULL;
>       }
>       sprintf(sql,"SELECT * FROM '%s';",nick);
>       if(rc!=SQLITE_OK)
>       {
>               fprintf(stderr,"SQL error: %s\n",zErrMsg);
>               sqlite3_free(zErrMsg);
>       }
>         user = ...// i'd like to store the db data in a string here...
>       return user;
> }
>
> Can anybody help me here? Thanks
>
>
> Regards
>
> Sevi
>
>
> --
> GMX FreeMail: 1 GB Postfach, 5 E-Mail-Adressen, 10 Free SMS.
> Alle Infos und kostenlose Anmeldung: http://www.gmx.net/de/go/freemail
>
> -----------------------------------------------------------------------------
> To unsubscribe, send email to [EMAIL PROTECTED]
> -----------------------------------------------------------------------------
>
>


-- 
Lazarus Registration
http://www.lazarusid.com/registration.shtml


-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to