Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

mysql C±à³Ì£¨Ò»£©mysql´íÎóÂ룬¹ØÓÚmysql_errno

¼ÙÉèÎÒÃÇʹÓÃmysql_real_queryÖ´ÐÐÁËÒ»ÌõsqlÓï¾äÖ®ºó£¬·µ»ØÖµÎª·Ç0Öµ£¬´ó¼Ò¶¼ÖªµÀÕâÊÇÕâÌõÓï¾äÖ´Ðгö´í£¬µ«ÊÇÎÒÃÇÏë
ÁË½âµØ¸üÏêϸµãµÄ»°£¬¾¿¾¹ÊÇʲôԭÒòµ¼ÖÂÁËÕâ¸ö´íÎóÄØ£¿Õâʱºò¾ÍµÃÓÃÉÏmysqlÌṩµÄÁíÍâÒ»¸öAPI£ºmysql_errno¡£
mysql_errno»áÌṩ×î½üÒ»´Îµ÷ÓõÄC API³ö´íµÄÐÅÏ¢£¨²»¼ûµÃÿ¸öAPI¶¼»á¶ÔÕâ¸öerrno½øÐÐÉèÖ㬵«ÊÇ×î³£ÓõÄmysql_real_queryÊÇ»áµÄ£©¡£Í¨¹ýmysql_errno·µ»ØµÄ´íÎóÂëÒ»°ã¶¼ÓйæÔò£º±ÈÈçÊôÓÚÇø¼ä[1000,2000)µÄ´íÎóÊÇÂß¼­´íÎ󣬱ÈÈç¼üÖµ³åÍ»ÕâÖÖ´íÎó£¬ÕâЩ´íÎóÊÇÓÉ·þÎñÆ÷·µ»ØµÄ£»ÆäËûµÄ±ÈÈç[2000, 3000)µÄµ±È»¾Í²»ÊÇÂß¼­´íÎóÁË¡£
ÁíÍ⣬Èç¹ûÏë¸ü¼ÓÏêϸµÄÐÅÏ¢£¬¿ÉÒÔͨ¹ýmysql_errorº¯Êý·µ»ØÒ»¸ö´íÎóÐÅÏ¢µÄ×Ö·û´®


Ïà¹ØÎĵµ£º

ÓÃMySQL´´½¨Êý¾Ý¿âºÍÊý¾Ý¿â±í

1¡¢Ê¹ÓÃSHOWÓï¾äÕÒ³öÔÚ·þÎñÆ÷Éϵ±Ç°´æÔÚʲôÊý¾Ý¿â£º
 
de>de>mysql> SHOW DATABASES; +----------+ | Database | +----------+ | mysql | | test | +----------+ 3 rows in set (0.00 sec)
    2¡¢´´½¨Ò»¸öÊý¾Ý¿âabccs
     mysql> CREATE DATABASE abccs; ......

Mysql°²×°°æÓëÃâ°²×°°æµÄÇл»Ê¹ÓÃ

Èç¹ûͬÒâϵͳÖÐͬʱ´æÔÚinstall mysqlºÍno—install mysql£¬ÄÇôÔõÑù½øÐÐÁ½¸ö°æ±¾µÄÇл»Ê¹ÓÃÄØ£¿ÓÖ»áÓöµ½Ê²Ã´ÑùµÄÎÊÌâÄØ£¿
Ê×ÏÈ£¬install mysqlµÄmysql·þÎñÊÇĬÈÏÆô¶¯µÄ£¬ÔÚÈÎÎñ¹ÜÀíÆ÷½ø³ÌÖпÉÒÔ¿´µ½¼¸ÌõsqlµÄ×ÖÑÛ£¬Èçmysqld.exe,sqlbrowser¡£ÕâÊÇinstall mysqlµÄ·þÎñ¡£ÄÇôͨ¹ý¿ì½Ý·½Ê½»ònavicat¾ÍÄÜÆô¶¯Ê¹ÓÃinstall ......

SQLiteÓëC½áºÏ

SQLite¹Ù·½ÍøÕ¾Àý×Ó£º
#include <stdio.h>
#include <sqlite3.h>
static int callback(void *NotUsed, int argc, char **argv, char **azColName){
int i;
for(i=0; i<argc; i++){
printf("%s = %s\n", azColName[i], argv[i] ? argv[i] : "NULL");
}
printf("\n");
return 0;
}
i ......

C ¶ÁÈ¡³ÌÐòµÄ»·¾³±äÁ¿

/*
 ============================================================================
 Name        : test.c
 Author      : alf
 Version     :
 Copyright   : Your copyright notice
  ......

ʵÏÖPHP·ÃÎÊMYSQLÊý¾Ý¿âµÄÀà

PHPµÄÒ»¸öÊý¾Ý¿â²Ù×÷Àà,ÒÔUTF8¸ñʽдÈë,Êý¾Ý¿âÄÚÖ±½ÓÏÔʾÕý³£ÖÐÎÄ,·ÀÖ¹²éѯ³ö´í
/**
* @author xggxnn
* ±¾ÀàÓÃÓÚʵÏÖÓйØÊý¾Ý¿âµÄ·ÃÎÊ
*
*/
class DBConnection {
private $host = "";
private $user = "";
private $pass = "";
private $DBname = "";
public $isConnected = false;
/**
* ¹¹Ôìº ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ