MYSQL, so oder so?

Wichtiger Hinweis: Bitte ändert nicht manuell die Schriftfarbe auf schwarz sondern belasst es bei der Standardeinstellung. Somit tragt ihr dazu bei dass euer Text auch bei Verwendung unseren dunklen Forenstils noch lesbar ist!

Tipp: Ihr wollt längere Codeausschnitte oder Logfiles bereitstellen? Benutzt unseren eigenen PasteBin-Dienst Link
  • Hallo Community,


    ich habe mich gerade beschäftigt meine MYSQL Speicherart etwas umzubauen, undzwar zurzeit habe ich es so:


    mysql_SetInt("accounts", "Knastzeit", SInfo[playerid][pKnastzeit], "Name", SInfo[playerid][pName]);
    mysql_SetInt("accounts", "Wanted", SInfo[playerid][pWanted], "Name", SInfo[playerid][pName]);
    mysql_SetInt("accounts", "Knast", SInfo[playerid][pKnast], "Name", SInfo[playerid][pName]);


    etc.


    und nun will ich es aber so:


    format(query,sizeof query,"UPDATE accounts id='%d' Level='%d' Geld='%.f2' Kills='%d'", etc...


    Macht das einen großen unterschied?

  • Ja weniger arbeit für den Server/MySQL Server ...
    diese mysql_SetInt Funktion ist zwar hilfreich, wenn du mal einen einzigen Wert speichern willst aber sehr belastend bei mehrfacher Benutzung -> du schießt den MySQL Server mit Queries zu, obwohl man alles in eine Query packen kann ^^




    Mfg

  • Habe es nun so:


    new query[1900];
    format(query,sizeof query,"UPDATE `accounts` id='%d' Level='%d' Geld='%.f2' Kills='%d' Tode='%d' Health='%.f0' HatRegi='%d' Alter='%d' Geschlecht='%d' Land='%d' Mission='%d' Noobmietet='%d' HatGeld='%d' Handy='%d' HandyVer='%d' SMSFrei='%d' FreiMin='%d' Guthaben='%.f2' Nummer='%d' Autover='%d' Perso='%d Lebenver='%d' Akku='%d' Payday='%d Handyart='%d' Admin='%d' Leader='%d Member='%d' Skin='%d' Knastzeit='%d Wanted='%d' Knast='%d' pBootschein='%d pHelischein='%d' pMotorradschein='%d pLKWschein='%d' pRollerschein='%d' pAutoschein='%d Bankkonto='%.f2' Kreditpayday='%d' Kredit='%.f2 Job='%d'",
    SInfo[playerid][pid],SInfo[playerid][pLevel],SInfo[playerid][pGeld],SInfo[playerid][pKills],SInfo[playerid][pTode],SInfo[playerid][pHealth],SInfo[playerid][pHatRegi], SInfo[playerid][pAlter],SInfo[playerid][pGeschlecht],SInfo[playerid][pLand],SInfo[playerid][pMission],SInfo[playerid][pNoobmietet],SInfo[playerid][pHatGeld],SInfo[playerid][pHandy],
    SInfo[playerid][pHandyVer],SInfo[playerid][pSMSFrei],SInfo[playerid][pFreiMin],SInfo[playerid][pGuthaben],SInfo[playerid][pNummer],SInfo[playerid][pAutover],
    SInfo[playerid][pPerso],SInfo[playerid][pLebenver],SInfo[playerid][pAkku],SInfo[playerid][pPayday],SInfo[playerid][pHandyart],SInfo[playerid][pAdmin],SInfo[playerid][pLeader], SInfo[playerid][pMember],SInfo[playerid][pSkin],SInfo[playerid][pKnastzeit],SInfo[playerid][pWanted],SInfo[playerid][pKnast], SInfo[playerid][pBootschein], SInfo[playerid][pHelischein],
    SInfo[playerid][pMotorradschein],SInfo[playerid][pLKWschein],SInfo[playerid][pRollerschein],SInfo[playerid][pAutoschein],SInfo[playerid][pBankkonto],SInfo[playerid][pKreditpayday],SInfo[playerid][pKredit],SInfo[playerid][pJob];
    mysql_query(query);
    mysql_free_result();


    Aber ich kriege immer ErrorS:


    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5584) : error 075: input line too long (after substitutions)
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5585) : error 037: invalid string (possibly non-terminated string)
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5585) : error 017: undefined symbol "UPDATE"
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5585) : error 029: invalid expression, assumed zero
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5585) : fatal error 107: too many error messages on one line


    Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase



    5 Errors.

  • strcat hängt einen string an einen string an


    bsp:

    string1[64];
    string2[64];
    stringfull[128];
    format(string1,sizeof string1, "Hallo");
    format(string2, sizeof string2, "Tschüss");
    strcat(string1,stringfull);
    strcat(string1,stringfull);


    So wären nun beide Strings dem fullstring hinzugefügt.


    Beavis:
    Wieso denn format und dann strcat? Wieso nicht direkt format und dort den alten string mit eingeben? mit %s ?

    ik bin der vito c:

  • Also so:


    new query1[900], query2[900], stringzusammen[1024];
    format(query1,sizeof query1,"UPDATE accounts id='%d' Level='%d' Geld='%.f2' Kills='%d' Tode='%d' Health='%.f0' HatRegi='%d' Alter='%d' Geschlecht='%d' Land='%d' Mission='%d' Noobmietet='%d' HatGeld='%d' Handy='%d' HandyVer='%d' SMSFrei='%d' FreiMin='%d' Guthaben='%.f2' Nummer='%d' Autover='%d' Perso='%d Lebenver='%d' Akku='%d' Payday='%d Handyart='%d'",
    SInfo[playerid][pid],SInfo[playerid][pLevel],SInfo[playerid][pGeld],SInfo[playerid][pKills],SInfo[playerid][pTode],SInfo[playerid][pHealth],SInfo[playerid][pHatRegi], SInfo[playerid][pAlter],SInfo[playerid][pGeschlecht],SInfo[playerid][pLand],SInfo[playerid][pMission],SInfo[playerid][pNoobmietet],SInfo[playerid][pHatGeld],SInfo[playerid][pHandy],
    SInfo[playerid][pHandyVer],SInfo[playerid][pSMSFrei],SInfo[playerid][pFreiMin],SInfo[playerid][pGuthaben],SInfo[playerid][pNummer],SInfo[playerid][pAutover], SInfo[playerid][pPerso],SInfo[playerid][pLebenver],SInfo[playerid][pAkku],SInfo[playerid][pPayday],SInfo[playerid][pHandyart]);
    format(query2,sizeof query2,"UPDATE accounts Admin='%d' Leader='%d Member='%d' Skin='%d' Knastzeit='%d Wanted='%d' Knast='%d' pBootschein='%d pHelischein='%d' pMotorradschein='%d pLKWschein='%d' pRollerschein='%d' pAutoschein='%d Bankkonto='%.f2' Kreditpayday='%d' Kredit='%.f2 Job='%d'",
    SInfo[playerid][pAdmin],SInfo[playerid][pLeader], SInfo[playerid][pMember],SInfo[playerid][pSkin],SInfo[playerid][pKnastzeit],SInfo[playerid][pWanted],SInfo[playerid][pKnast], SInfo[playerid][pBootschein], SInfo[playerid][pHelischein],
    SInfo[playerid][pMotorradschein],SInfo[playerid][pLKWschein],SInfo[playerid][pRollerschein],SInfo[playerid][pAutoschein],SInfo[playerid][pBankkonto],SInfo[playerid][pKreditpayday],SInfo[playerid][pKredit],SInfo[playerid][pJob]);
    strcat(query1,stringzusammen);
    strcat(query2,stringzusammen);
    mysql_query(stringzusammen);
    mysql_free_result();

  • format(query, sizeof(query), "UPDATE table SET \
    asdf = #, \
    qwer = #, \
    yxcv = #, \
    etc etc")


    Sollte eigentlich problemlos funktionieren.


    Mein CS:GO Server: 62.75.168.39:27016


    Ich bin so hungrig, dass ich vor lauter Durst nicht weiß, was ich rauchen soll - so müde bin ich!
    Freedom is just another word for 'Nothing left to lose'

  • Mit \ kannst du quasi einen Zeilenumbruch einbauen, ohne, dass PAWN rumjammert. So hast du nicht das Problem, dass der Fließtext zu lang für den Compiler wird.


    Mein CS:GO Server: 62.75.168.39:27016


    Ich bin so hungrig, dass ich vor lauter Durst nicht weiß, was ich rauchen soll - so müde bin ich!
    Freedom is just another word for 'Nothing left to lose'

  • new query[900] = "UPDATE accounts id='%d' Level='%d' Geld='%.f2' Kills='%d' Tode='%d' Health='%.f0' HatRegi='%d' Alter='%d' Geschlecht='%d' Land='%d' Mission='%d' Noobmietet='%d' HatGeld='%d' Handy='%d' HandyVer='%d' SMSFrei='%d' FreiMin='%d' Guthaben='%.f2' Nummer='%d' Autover='%d' Perso='%d Lebenver='%d' Akku='%d' Payday='%d Handyart='%d'";
    strcat(query,"Admin='%d' Leader='%d Member='%d' Skin='%d' Knastzeit='%d Wanted='%d' Knast='%d' pBootschein='%d pHelischein='%d' pMotorradschein='%d pLKWschein='%d' pRollerschein='%d' pAutoschein='%d Bankkonto='%.f2' Kreditpayday='%d' Kredit='%.f2 Job='%d'",
    SInfo[playerid][pid],SInfo[playerid][pLevel],SInfo[playerid][pGeld],SInfo[playerid][pKills],SInfo[playerid][pTode],SInfo[playerid][pHealth],SInfo[playerid][pHatRegi], SInfo[playerid][pAlter],SInfo[playerid][pGeschlecht],SInfo[playerid][pLand],SInfo[playerid][pMission],SInfo[playerid][pNoobmietet],SInfo[playerid][pHatGeld],SInfo[playerid][pHandy],
    SInfo[playerid][pHandyVer],SInfo[playerid][pSMSFrei],SInfo[playerid][pFreiMin],SInfo[playerid][pGuthaben],SInfo[playerid][pNummer],SInfo[playerid][pAutover], SInfo[playerid][pPerso],SInfo[playerid][pLebenver],SInfo[playerid][pAkku],SInfo[playerid][pPayday],SInfo[playerid][pHandyart]
    SInfo[playerid][pAdmin],SInfo[playerid][pLeader], SInfo[playerid][pMember],SInfo[playerid][pSkin],SInfo[playerid][pKnastzeit],SInfo[playerid][pWanted],SInfo[playerid][pKnast], SInfo[playerid][pBootschein], SInfo[playerid][pHelischein],
    SInfo[playerid][pMotorradschein],SInfo[playerid][pLKWschein],SInfo[playerid][pRollerschein],SInfo[playerid][pAutoschein],SInfo[playerid][pBankkonto],SInfo[playerid][pKreditpayday],SInfo[playerid][pKredit],SInfo[playerid][pJob]);
    mysql_query(query);
    mysql_free_result();


    So hab ich es nun, kriege aber millionen warnings...

  • C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5586 -- 5587) : warning 202: number of arguments does not match definition
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5586 -- 5587) : warning 202: number of arguments does not match definition
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5586 -- 5587) : warning 202: number of arguments does not match definition
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5586 -- 5587) : warning 202: number of arguments does not match definition
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5586 -- 5587) : warning 202: number of arguments does not match definition
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5586 -- 5587) : warning 202: number of arguments does not match definition
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5586 -- 5587) : warning 202: number of arguments does not match definition
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5586 -- 5587) : warning 202: number of arguments does not match definition
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5586 -- 5587) : warning 202: number of arguments does not match definition
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5586 -- 5587) : warning 202: number of arguments does not match definition
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5586 -- 5587) : warning 202: number of arguments does not match definition
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5586 -- 5587) : warning 202: number of arguments does not match definition
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5586 -- 5587) : warning 202: number of arguments does not match definition
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5586 -- 5588) : warning 202: number of arguments does not match definition
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5586 -- 5588) : warning 202: number of arguments does not match definition
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5586 -- 5588) : warning 202: number of arguments does not match definition
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5586 -- 5588) : warning 202: number of arguments does not match definition
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5586 -- 5588) : warning 202: number of arguments does not match definition
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5586 -- 5588) : warning 202: number of arguments does not match definition
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5586 -- 5588) : warning 202: number of arguments does not match definition
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5586 -- 5588) : warning 202: number of arguments does not match definition
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5586 -- 5588) : warning 202: number of arguments does not match definition
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5586 -- 5588) : warning 202: number of arguments does not match definition
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5586 -- 5589) : warning 202: number of arguments does not match definition
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5586 -- 5589) : error 001: expected token: ",", but found "-identifier-"
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5589) : warning 215: expression has no effect
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5589) : warning 215: expression has no effect
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5589) : warning 215: expression has no effect
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5589) : warning 215: expression has no effect
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5589) : warning 215: expression has no effect
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5589) : warning 215: expression has no effect
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5589) : warning 215: expression has no effect
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5589) : warning 215: expression has no effect
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5589) : warning 215: expression has no effect
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5589 -- 5590) : warning 215: expression has no effect
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5589 -- 5590) : warning 215: expression has no effect
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5589 -- 5590) : warning 215: expression has no effect
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5589 -- 5590) : warning 215: expression has no effect
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5589 -- 5590) : warning 215: expression has no effect
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5589 -- 5590) : warning 215: expression has no effect
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5589 -- 5590) : warning 215: expression has no effect
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5589 -- 5590) : warning 215: expression has no effect
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5590) : error 001: expected token: ";", but found ")"
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5590) : error 029: invalid expression, assumed zero
    C:\Users\Moritz McGarrett\Desktop\Selfmade\gamemodes\Selfmade.pwn(5590) : fatal error 107: too many error messages on one line


    Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase



    4 Errors.

  • do.de - Domain-Offensive - Domains für alle und zu super Preisen