I-CPP (aka C ++) + MySQL

MySQL

Sanibonani nonke, lapha nginiphathela isibonelo sokuthi ukuxhumana phakathi kwe-C ++ ne-MySQL kuzoba kanjani ku-GNU / Linux, impela lesi yisibonelo nje. Okokuqala ukuhlanganisa ngizosebenzisa i-G ++ futhi kufanele babe namaphakeji afakiwe libmysql ++ y libmysql ++ - dev . Nasi isibonelo:

#hlanganisa #hlanganisa #hlanganisa usebenzisa i-namespace std; # chaza i-SERVER "HOST" # chaza USER "USR" # chaza i-PASSWORD "PSWD" #define DATABASE "example" int main () {MYSQL * connect; xhuma = mysql_init (NULL); uma (! xhuma) {cout << "Ukuqalisa kwe-MySQL kwehlulekile"; buyela 1; } connect = mysql_real_connect (xhuma, "HOST", "USER", "PASWD", "DATA BASE", 0, NULL, 0); uma (xhuma) {cout << "uxhumano Luphumelele \ n"; } okunye {cout << "ukuxhumeka kwehlulekile \ n"; } I-MYSQL_RES * isethi kabusha; MYSQL_ROW umugqa; i-mysql_query (xhuma, "khetha * kusuka kudatha;"); unsigned int i = 0; res_set = mysql_store_result (xhuma); unsigned int numrows = mysql_num_rows (res_set); cout << endl; cout << "\ t ---------------------------------------------- ------------------------- \ t "<< endlunkulu; ngenkathi (((row = mysql_fetch_row (res_set))! = NULL)) {// cout << "% s \ n", umugqa [i]! = NULL? umugqa [i]: "NULL"; cout << "\ t | \ t" << umugqa [i] << "\ t | \ t" << umugqa [i + 1] << "\ t | \ t" << umugqa [i + 2] << "\ t | \ t" << endl; cout << "\ t ---------------------------------------------- ------------------------- \ t "<< endlunkulu; } i-mysql_ vala (xhuma); buyela 0; }

Yebo, uma ungazi ukuthi ungahlanganisa kanjani ku-G ++ lesi yisibonelo:

g ++ -o main main.cpp -L / usr / include / mysql -lmysqlclient -I / usr / include / mysql

Ngemuva kwalokho uyayigijima futhi ibukeke kanjena:

------------------------------------- | 1 | UCarmen | 46 | --------------------------------- | 2 | UJuan | 56 | --------------------------------------

Qaphela: ungayihlanganisa futhi usebenzisa i-MAKEFILE METHOD.


Okuqukethwe yi-athikili kunamathela ezimisweni zethu ze izimiso zokuhlelela. Ukubika iphutha chofoza lapha.

Amazwana ayi-33, shiya okwakho

Shiya umbono wakho

Ikheli lakho le ngeke ishicilelwe. Ezidingekayo ibhalwe nge *

*

*

  1. Ubhekele imininingwane: Miguel Ángel Gatón
  2. Inhloso yedatha: Lawula Ugaxekile, ukuphathwa kwamazwana.
  3. Ukusemthethweni: Imvume yakho
  4. Ukuxhumana kwemininingwane: Imininingwane ngeke idluliselwe kubantu besithathu ngaphandle kwesibopho esisemthethweni.
  5. Isitoreji sedatha: Idatabase ebanjwe yi-Occentus Networks (EU)
  6. Amalungelo: Nganoma yisiphi isikhathi ungakhawulela, uthole futhi ususe imininingwane yakho.

  1.   pvv92 kusho

    I-C ++ ... lolo limi lwanginqoba kudala ...

    1.    eliotime3000 kusho

      Ngikulambele okwengeziwe ngalolo limi lohlelo (ukucaciseleka namathuba okukuhlinzekayo akunakubuyiselwa).

      1.    pvv92 kusho

        Angisho ukuthi cha, ngoba nje kwakunzima kakhulu kimi, i-python noma i-mono, kubonakala kulula ukuyisebenzisa.

        1.    I-Giskard kusho

          Namathela ngePython. Kukwenza ukhiqize kakhudlwana ngesikhathi esincane.

        2.    eliotime3000 kusho

          IPython kungenzeka, ukuthi ikwazi ukulungisa izimbungulu ezihamba kancane ezinhlelweni ezinjenge-software-isikhungo noma i-Ubiquiti, kepha iJava, ukubulala nje isikhathi.

          Eqinisweni, nge-C ++ ngingawaqonda kangcono amakhodi (yize iningi libona umugqa wamakhodi angafundeki) futhi ngingaba nomqondo ocacile wokuthi izokwenzani (yize iJava kulula ukuyiqonda ikhodi okokuqala, Ngikubona sengathi kuyi-BASIC futhi ukukhuluma iqiniso, ngincamela ukusebenza ne-OpenJDK esikhundleni seJava JDK ngokwesaba ukuthi i-Oracle izobeka izimbungulu eziningi ze-fuck)

    2.    nelson kusho

      nami futhi

  2.   i-ferchmetal kusho

    Ngiyabonga mngani.

  3.   Eduardo kusho

    Isibonelo esiyisisekelo? Ngemuva kwalokho kuzoba okwakudala:
    isigaba: 2 + 2 = 4
    umsebenzi: 2 × 3 = 6
    Isivivinyo: uma u-Eduardo enamawolintshi angama-20 futhi kufanele awasakaze phakathi kwezingane ezi-4, bungakanani ubunzima bomzimba wezingane?

    1.    eliotime3000 kusho

      1.- Sombulula inkinga (into ebaluleke kakhulu nokuthi yini ngempela ethatha isikhathi eside kumfundamakhwela)
      2.- Humusha isixazululo ku-C ++ (uma ngabe yilolo limi, lezi ezintsha zizodela ezimeni eziningi nokuningi uma zisebenzisa i-GNU Emacs).
      3.- Ukulungisa iphutha njengokuqapha nokuhlanganisa (empeleni kungenye indlela, kepha bambalwa abenza leyo nqubo).

      I-PS: Lokho kuhlolwa kuyaphikisana ne-smug / pedantic.

  4.   Eduardo kusho

    Ukuxolisa kwecala lokuphawula kabili, kepha leli khasi linginike iphutha langaphakathi leseva futhi mhlawumbe ngenxa yalokhu, lapho liphinda lizama, liphinde lathunyelwa.
    Ukubingelela nokubonga ngokuthunyelwe !!

    1.    eliotime3000 kusho

      Ayikho inkinga. Noma kunjalo, ngiphawula ngeChromium ebusuku ngeWindows futhi angizange ngibe nezinkinga zalolo hlobo lapho ngiphawula (yize ngincoma ukuthi ubhalise ukuze uhlelo lokuphawula luzokuphonsa amaphutha amaningi kuneWindows Millenium).

      1.    eliotime3000 kusho

        Bengifuna ukuthi: "yize ngincoma ukuthi ubhalise ukuze uhlelo lokuphawula lukuphonse amaphutha ambalwa kuneWindows Millenium" [errare humanum est].

        1.    pvv92 kusho

          i-carpe dium LOL

  5.   eliotime3000 kusho

    Leyo khodi iyi-C ++ enhle kunazo zonke engake ngazibona (isibukeli sedathabheyisi yesitayela se-KISS).

    Manje, uma le khodi ingahlanganiswa ku-Windows kusetshenziswa ama-GNU Emacs ngokuhlangana ne-GCC ku-Windows (kufakwe ne-MySQL / MariaDB), kungaba ingqophamlando.

  6.   i-ratakill kusho

    Akungabazeki ukuthi i-c ++ ingcono kakhulu esinayo, ngenze inani elingenamkhawulo lezivivinyo mayelana nokusebenza namathuba okusinikeza wona futhi ngaphandle kokungabaza akukho okudlula lokho ngiyabona ukuthi kungaba yikhanda kwabanye

    1.    eliotime3000 kusho

      Ngiyaluthanda lolu limi, kepha anginakho ukuzijwayeza (futhi ngokwanele) ukuthi ngikwazi ukulwazi kahle ngokuphelele futhi ngikwazi ukuhlanganisa uhlelo lokusebenza olubonakalayo oluhloniphekile neQt.

  7.   jamin-samuel kusho

    Huy cha

    Ngincamela iPython

    😀

    1.    i-ratakill kusho

      Hhayi-ke wonke umuntu ohlanyayo ngemikhonzo yakhe yetimu

    2.    I-Giskard kusho

      Ukukhetha okuhle kakhulu.

    3.    eliotime3000 kusho

      [ukuzicabangela] Ukuvilapha [/ ukuzithanda].

  8.   UJulian kusho

    Ngikhetha i-VB.NET, kulula kakhulu futhi inokusekelwa okuhle kwe-SQL Server. Ngaphezu kokukhiqiza kakhulu kunezinye izilimi kanye nolunye olucelwe kakhulu lapho ufuna umsebenzi. Angifuni ukuchitha isikhathi sami nge-C ++

    1.    pvv92 kusho

      Uma sikubeka kanjena, okucelwa kakhulu imvamisa yi-crap yeJava.

      1.    eliotime3000 kusho

        Iyafana ne-VB.NET, kepha inemifanekiso eminingi kakhulu futhi akusizi ukusebenza ku-GNU / Linux.

  9.   i-ratakill kusho

    Ngincoma kuphela iphenyo le-C ++ bc ukudala ukuthengiswa okulula ku-c ++, python kanye ne-qt nokumangala kocingo:
    IPython-> 7.6 mb
    I-Qt -> 27 mb (XD)
    C ++ -> 2.4 mb

    Kulungile wonke umuntu odonsela iziphetho zakhe imikhonzo

    1.    I-Giskard kusho

      IPython 7.6MB ??? Akunakwenzeka! Akunakwenzeka. Uma bengelutho ngaphezu kwemibhalo. Noma ubunezithombe? Yabelana ngekhodi. Ngale ndlela sonke sikubona futhi siqhathanise. Senze sikholwe.

      1.    i-ratakill kusho

        Uqinisile i-bug python encane ayisebenzisanga i-7.6 mb kepha uma ingu-6.2 mb ngakho ungitshelani manje ...
        Le yikhodi futhi ngicabanga ukuthi ayinakulungiswa kangcono:
        #! / usr / bin / python
        kusuka ku-gi.repository import Gtk

        win = Gtk.Window ()
        win.connect ("susa-umcimbi", Gtk.main_quit)
        win.show_all ()
        IGtk.main ()

        1.    I-Giskard kusho

          Ngicabanga ukuthi usho ukusetshenziswa kwe-RAM. Into ukuthi, ePython futhi cishe kunoma yiluphi ulimi, ukala ijika le-asymptotic njengoba wenza ikhodi ibe yinkimbinkimbi. Ukuhlolwa nje ngisebenzise umdlalo engiwenza nePyGame. I-Animation + imisindo yangemuva + yemicimbi futhi ingakafiki ku-14MB. Ngokusobala uhlelo lwakho ngeke lube lula njengewindi kepha lube yinkimbinkimbi ngokwengeziwe, ekugcineni uzobona ukuthi, uma unekhodi eyanele, ukulungiswa okukhulu kuyo ngeke kukulethele ukwanda okukhulu ekusetshenzisweni kwe-RAM.

        2.    I-Giskard kusho

          Ukwenza lula lokhu engikuchaza kancane: Awukwazi ukwenza iphrofayili yesikhathi uma ungasebenzisi ingxenye yekhodi izikhathi eziyizinkulungwane ezimbalwa, akunjalo? Yebo, ngendlela efanayo awukwazi ukuthi ulimi ludla okuningi noma okuncane ngokubuka nje isibonelo esilula kakhulu. Eqinisweni, iqhinga ukubuka okuyinkimbinkimbi kakhulu ongakwenza.

          1.    i-ratakill kusho

            Kulungile ekuqondeni kwami ​​ezingeni lokuhlela le 01010111, ukuhlanganisa bese kuba c, akunakwenzeka ukuthi ngolimi olusezingeni eliphakeme njenge-python lidlula i-ac / c ++ ekusebenzeni (kuzo zonke izici) futhi, okungcono kunokulula kakhulu isibonelo esinjengaleso sokwakha iwindi ukuze ubone umehluko we-3.8 mb ngokukhombisa iwindi elilula, lapho ufaka umthwalo kuhlelo lwakho (uhlelo olukhulu, olunesisindo esihle esinamafomu angaphezu kwama-5, futhi lufaka amakilasi, ifa, i-polymorphism, imisebenzi ebonakalayo, izikhombisi nokuningi ukunikeza isibonelo) Ngiyakuqinisekisa ukuthi uzowushintsha umbono wakho, ngifuna ukukubeka kucace ukuthi angigxeki ezinye izilimi ezihlelayo futhi kakhulu i-Python ku-cantrario, ngiphawula kuphela futhi uvivinye ngokuhlola ubuhle nobubi engikubona ngamehlo ngaphandle kwesikhuthazo sokujulisa imikhonzo

          2.    I-Giskard kusho

            Bheka lento:

            http://www.youtube.com/watch?v=cPVlYWxcu18

            Kepha bukela ividiyo ephelele. Ungakhohlisi ukuthi kungenjalo uzomane unikeze umbono osuselwa kubandlululo.

          3.    I-Giskard kusho

            Kunoma ikuphi, wawungangiqondi. Njengoba uyenza lukhuni le ndaba, bobabili bazoba nesisindo esilinganayo. Ekhasini likaLazaru banikeza igrafu ngalokho ngalokho, beqhathanisa uLazaru noC.
            Ekugcineni konke kungumngane ohlobene. Ngoba umuntu akahlali nge-RAM kuphela.

    2.    eliotime3000 kusho

      Okungenani i-QT iyahambisana ne-Aqua, Win32 (kanye nezinhlobonhlobo zazo ze-Aero neMetro) nezinye izixhumi ngaphandle kwe-LXDE (kubukeka sengathi iWindows 95 ithembekile).

      1.    pvv92 kusho

        gtk2 ku-aqua kubukeka kukuhle ...