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;
}
int main(int argc, char **argv){
sqlite3 *db;
char *zErrMsg = 0;
int rc;
if( argc!=3 ){
fprintf(stderr, "Usage: %s DATABASE SQL-STATEMENT\n", argv[0]);
exit(1);
}
rc = sqlite3_open(argv[1], &db);
if( rc ){
fprintf(stderr, "Can't open database: %s\n", sqlite3_errmsg(db));
sqlite3_close(db);
exit(1);
}
rc = sqlite3_exec(db, argv[2], callback, 0, &zErrMsg);
if( rc!=SQLITE_OK ){
fprintf(stderr, "SQL error: %s\n", zErrMsg);
sqlite3_free(zErrMsg);
}
sqlite3_close(db);
return 0;
}
ÓÃgcc±àÒë
gcc -lsqlite3 sqlite.c -o sqlite
ÔËÐÐʱ./sqlite ab.db 'SQL Óï¾ä'
Ïà¹ØÎĵµ£º
I2CÊÇPhillips¿ª·¢µÄ2ÏߵĴ®ÐÐ×ÜÏßÐÒ顣ͨ³£Ó¦ÓÃÔÚǶÈëʽϵͳÖÐÈò»Í¬µÄ×é¼þͨÐÅ£¬PCÖ÷°å¿ÉÒÔͨ¹ýI2CÀ´Ó벻ͬµÄ´«¸ÐÆ÷ͨÐÅ¡£ÕâЩ´«¸ÐÆ÷ͨ³£±¨¸æ·çÉÈËٶȣ¬´¦ÀíÆ÷ζȺÍÕû¸öÓ²¼þϵͳµÄÐÅÏ¢£¬Õâ¸öÐÒéÒ²¿ÉÒÔÓÃÔÚRAM chipsÉÏ£¬Ïò²Ù×÷ϵͳÌṩDIMMµÄÐÅÏ¢¡£
ÔÚ2.0ʱI2CµÄkernelÔ´Âë²»ÔÚÄÚºËÀïµÄ£¬2.4Äں˰üÀ¨ÁËÒ»µã¶ÔI2CµÄÖ§³Ö ......
×î½üÔÚ¿´Linux 2.6.21Äں˵ÄI2CÇý¶¯£¬Ò²ÔÚÍøÉϲéÁËÒ»ÏÂ×ÊÁÏ£¬ÓдíÒ²Óжԣ¬ÓÐЩÐĵ㬼ǼÏÂÀ´°É¡£ÀïÃæÈÏʶ»òÐí¶àÓв»µ±Ö®´¦£¬»¹¿ÒÇëÖ¸Õý¡£
1. I2C ÐÒé
1.1 I2C×ÜÏß¹¤×÷ÔÀí
I2C×ÜÏßÊÇÓÉÊý¾ÝÏßSDAºÍʱÖÓSCL¹¹³ÉµÄ´®ÐÐ×ÜÏߣ¬¸÷ÖÖ±»¿ØÖÆÆ÷¼þ¾ù²¢ÁªÔÚÕâÌõ×ÜÏ ......
´ÓCµ½Perl
2008Äê11ÔÂ19ÈÕ ÐÇÆÚÈý 23:06
×÷ÕߣºÍõ´Ï <xiyou.wangcong@gmail.com>
ºÜ¶àÈ˲¢²»ÊÇ°ÑPerlµ±×öµÚÒ»Ãűà³ÌÓïÑÔÀ´Ñ§Ï°µÄ£¬ÔÚѧPerl֮ǰÍùÍùÒѾÕÆÎÕÁË
Ò»Á½ÃÅÆäËüÓïÑÔ¡£ËäÈ»ÓÐÕùÒ飬µ«ÊÇÎÒ¸öÈËÈÏΪPerlȷʵ²»ÊʺÏ×÷ΪÈëÃÅÓïÑÔ¡£ÕâƪÎÄÕ¾ÍÊÇд¸øÄÇЩÊìϤC¶øÇÒÓÖÏë
ÕÆÎÕPerlµ ......
1. ³õʼ»¯Ò»¸öÁ¬½Ó¾ä±ú
MYSQL *mysql_init(MYSQL *);
ÕýÈ·£º·µ»ØÒ»¸öÖ¸ÏòзÖÅäµÄÁ´½Ó¾ä±ú½á¹¹µÄÖ¸Õë
´íÎó£ºNULL
×¢£º¸Ãº¯ÊýµÄ´«Èë²ÎÊýͨ³£ÎªNULL¼´¿É¡£
2. ½¨Á¢ÎïÀíÁ¬½Ó
MYSQL *mysql_real_connect(MYSQL *connect ......
3.2 ¸ßЧÂʲâÊÔ£ºËÄÁ½°Îǧ½ï
ÉÏÒ»½Ú½éÉÜÁËһЩËÆÊǶø·ÇµÄ¸ßЧÂÊ·½·¨£¬ÄÇô£¬ÔõÑù²ÅÄÜÕæÕý¸ßЧÂʲâÊÔÄØ£¿ÕæÕýµÄ¸ßЧÂÊ£¬²»ÄܺöÂÔÈ˵ÄÖÇ»ÛÕâÒ»¹Ø¼üÒòËØ¡£
ÓÉÓÚ¹¤¾ß²»¿ÉÄÜ×Ô¶¯Á˽â´úÂëµÄÉè¼Æ¹¦ÄÜ£¬Ö»ÓÐÈ˲ÅÁ˽⣬Òò´Ë£¬Ö»ÓÐÈ˵ÄÖǻۼ°Ê±½éÈ룬¹¤¾ß²ÅÄÜ×öÕýÈ·µÄÊÂÇ飬²ÅÄÜ´ïµ½ÕæÕýµÄ¸ßЧÂÊ¡£
&nb ......