Çözüldü DirectQuery: AsyncSQL::DirectQuery : mysql_query error:

Bu konu çözüme ulaştırılmıştır. Çözüm için konuya yazılan tüm yorumları okumayı unutmayın. Eğer konudaki yorumlar sorununuzu çözmediyse yeni bir konu açabilirsiniz.
Durum
İçerik kilitlendiği için mesaj gönderimine kapatıldı.

melihalbayrak

Geliştirici
Geliştirici
Yardımsever Üye
Usta Üye
Mesaj
1.246
Çözümler
81
Beğeni
673
Puan
1.109
Ticaret Puanı
0
SYSER:
SYSERR: Mar 19 13:38:57 :: DirectQuery: AsyncSQL::DirectQuery : mysql_query error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'window = 'PRIVATE_SHOP' and owner_id=12' at line 1
query: SELECT id FROM item WHERE window = 'PRIVATE_SHOP' and owner_id=12


ClientManager.cpp:
Linkleri görebilmek için giriş yap veya kayıt ol.

Syserin geçtiği satır ise 500. satırda başlıyor.

C++:
            pi->pSafebox = pSafebox;

            char szQuery[1024];
            snprintf(szQuery, sizeof(szQuery), "SELECT id, window+0, pos, count, vnum, socket0, socket1, socket2, attrtype0, attrvalue0, attrtype1, attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6"
#ifdef ENABLE_PREMIUM_PRIVATE_SHOP
                    ", price, shop_id "
#endif
            "FROM item%s WHERE `owner_id`=%d AND `window`='PRIVATE_SHOP'", GetTablePostfix(), pi->player_id);
           
            pi->account_index = 1;

            CDBManager::instance().ReturnQuery(szQuery, QID_SAFEBOX_LOAD, pkPeer->GetHandle(), pi);
 
Çözüm
Anydesk ile bağlandıktan sonra kodları inceledim. Birden fazla dosyada hata meydana geliyor.

Kod:
SYSERR: Mar 19 17:08:59 :: DirectQuery: AsyncSQL::DirectQuery : mysql_query error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'window = 'PRIVATE_SHOP' and owner_id=12' at line 1
query: SELECT id FROM item WHERE window = 'PRIVATE_SHOP' and owner_id=12
Bu hatanın kaynağı game/src/char.cpp altındaki şu koddan kaynaklı
C++:
    std::auto_ptr<SQLMsg> pmsg(DBManager::instance().DirectQuery("SELECT id FROM item%s WHERE window = 'PRIVATE_SHOP' and owner_id=%d",
                get_table_postfix(), GetPlayerID()));

Şu şekilde değiştirdik
C++:
...
MySQL sürümü nedir?
 
C++:
             pi->pSafebox = pSafebox;

            char szQuery[1024];
            snprintf(szQuery, sizeof(szQuery), "SELECT id, window+0, pos, count, vnum, socket0, socket1, socket2, attrtype0, attrvalue0, attrtype1, attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6"
#ifdef ENABLE_PREMIUM_PRIVATE_SHOP
                    ", price, shop_id "
#endif
            "FROM item%s WHERE `owner_id`=%d AND `window`=`PRIVATE_SHOP`", GetTablePostfix(), pi->player_id);
         
            pi->account_index = 1;

            CDBManager::instance().ReturnQuery(szQuery, QID_SAFEBOX_LOAD, pkPeer->GetHandle(), pi);


Bu şekilde dener misin.
 
C++:
             pi->pSafebox = pSafebox;

            char szQuery[1024];
            snprintf(szQuery, sizeof(szQuery), "SELECT id, window+0, pos, count, vnum, socket0, socket1, socket2, attrtype0, attrvalue0, attrtype1, attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6"
#ifdef ENABLE_PREMIUM_PRIVATE_SHOP
                    ", price, shop_id "
#endif
            "FROM item%s WHERE `owner_id`=%d AND `window`=`PRIVATE_SHOP`", GetTablePostfix(), pi->player_id);
        
            pi->account_index = 1;

            CDBManager::instance().ReturnQuery(szQuery, QID_SAFEBOX_LOAD, pkPeer->GetHandle(), pi);


Bu şekilde dener misin.
Yaptım sonuç bu ch1 syser;

SYSERR: Mar 19 14:49:26 :: DirectQuery: AsyncSQL::DirectQuery : mysql_query error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'window = 'PRIVATE_SHOP' and owner_id=12' at line 1
query: SELECT id FROM item WHERE window = 'PRIVATE_SHOP' and owner_id=12
 
Sorgu kısmını komple şu şekilde değiştirmeyi deneyin:

C++:
"SELECT id, window+0, pos, count, vnum, socket0, socket1, socket2, "
"attrtype0, attrvalue0, "
"attrtype1, attrvalue1, "
"attrtype2, attrvalue2, "
"attrtype3, attrvalue3, "
"attrtype4, attrvalue4, "
"attrtype5, attrvalue5, "
"attrtype6, attrvalue6, "
#ifdef ENABLE_PREMIUM_PRIVATE_SHOP
"price, shop_id "
#endif
"FROM item%s WHERE `owner_id`=%d AND `window`='PRIVATE_SHOP'", GetTablePostfix(), pi->player_id);
 
Sorgu kısmını komple şu şekilde değiştirmeyi deneyin:

C++:
"SELECT id, window+0, pos, count, vnum, socket0, socket1, socket2, "
"attrtype0, attrvalue0, "
"attrtype1, attrvalue1, "
"attrtype2, attrvalue2, "
"attrtype3, attrvalue3, "
"attrtype4, attrvalue4, "
"attrtype5, attrvalue5, "
"attrtype6, attrvalue6, "
#ifdef ENABLE_PREMIUM_PRIVATE_SHOP
"price, shop_id "
#endif
"FROM item%s WHERE `owner_id`=%d AND `window`='PRIVATE_SHOP'", GetTablePostfix(), pi->player_id);
SYSERR: Mar 19 15:49:05 :: DirectQuery: AsyncSQL::DirectQuery : mysql_query error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'window+0,pos,count,vnum,socket0,socket1,socket2,attrtype0,attrvalue0,attrtype1,a' at line 1
query: SELECT id, owner_id, window+0,pos,count,vnum,socket0,socket1,socket2,attrtype0,attrvalue0,attrtype1,attrvalue1,attrtype2,attrvalue2,attrtype3,attrvalue3,attrtype4,attrvalue4,attrtype5,attrvalue5,attrtype6,attrvalue6,applytype0,applyvalue0,applytype1,applyvalue1,applytype2,applyvalue2,applytype3,applyvalue3,applytype4,applyvalue4,applytype5,applyvalue5,applytype6,applyvalue6,applytype7,applyvalue7, price, shop_id FROM player.item WHERE shop_id=32

SYSERR: Mar 19 15:50:19 :: DirectQuery: AsyncSQL::DirectQuery : mysql_query error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'window = 'PRIVATE_SHOP' and owner_id=12' at line 1
query: SELECT id FROM item WHERE window = 'PRIVATE_SHOP' and owner_id=12
 
SYSERR: Mar 19 15:49:05 :: DirectQuery: AsyncSQL::DirectQuery : mysql_query error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'window+0,pos,count,vnum,socket0,socket1,socket2,attrtype0,attrvalue0,attrtype1,a' at line 1
query: SELECT id, owner_id, window+0,pos,count,vnum,socket0,socket1,socket2,attrtype0,attrvalue0,attrtype1,attrvalue1,attrtype2,attrvalue2,attrtype3,attrvalue3,attrtype4,attrvalue4,attrtype5,attrvalue5,attrtype6,attrvalue6,applytype0,applyvalue0,applytype1,applyvalue1,applytype2,applyvalue2,applytype3,applyvalue3,applytype4,applyvalue4,applytype5,applyvalue5,applytype6,applyvalue6,applytype7,applyvalue7, price, shop_id FROM player.item WHERE shop_id=32

SYSERR: Mar 19 15:50:19 :: DirectQuery: AsyncSQL::DirectQuery : mysql_query error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'window = 'PRIVATE_SHOP' and owner_id=12' at line 1
query: SELECT id FROM item WHERE window = 'PRIVATE_SHOP' and owner_id=12
C++:
        char szQuery[512];
        snprintf(szQuery, sizeof(szQuery),
                "SELECT id, `window`+0, pos, count, vnum, socket0, socket1, socket2, "
                "attrtype0, attrvalue0, "
                "attrtype1, attrvalue1, "
                "attrtype2, attrvalue2, "
                "attrtype3, attrvalue3, "
                "attrtype4, attrvalue4, "
                "attrtype5, attrvalue5, "
                "attrtype6, attrvalue6 "
                "FROM item%s WHERE owner_id=%d AND `window`='%s'",
                GetTablePostfix(), pi->account_id, pi->ip[0] == 0 ? "SAFEBOX" : "MALL");

Bu blok bende varsayılan olarak bu şekilde tanımlı. Karşılaştırma yapın isterseniz.
Navicat tarafını da eksiksiz yaptığınızdan emin olun.
 
C++:
        char szQuery[512];
        snprintf(szQuery, sizeof(szQuery),
                "SELECT id, `window`+0, pos, count, vnum, socket0, socket1, socket2, "
                "attrtype0, attrvalue0, "
                "attrtype1, attrvalue1, "
                "attrtype2, attrvalue2, "
                "attrtype3, attrvalue3, "
                "attrtype4, attrvalue4, "
                "attrtype5, attrvalue5, "
                "attrtype6, attrvalue6 "
                "FROM item%s WHERE owner_id=%d AND `window`='%s'",
                GetTablePostfix(), pi->account_id, pi->ip[0] == 0 ? "SAFEBOX" : "MALL");

Bu blok bende varsayılan olarak bu şekilde tanımlı. Karşılaştırma yapın isterseniz.
Navicat tarafını da eksiksiz yaptığınızdan emin olun.
Karşılaştırdım başka fileslerde ama bir sorun gözükmüyor sorunu bulmak zor çünkü yeni bir offline shop ve hiç eklen birini bulamadım bulsam dosya karşılaştıracam ama yok. İlk kurduğumdan beri sürekli bu hatalarla uğraşıyorum her sorunda ‘ bu sembol ile çözdüm navicat ayarı ile ama bunu çözemedim gitti. Offline pazarı açtığımda bu syser düşüyor.
 
Şu kodu;
C++:
            snprintf(szQuery, sizeof(szQuery), "SELECT id, window+0, pos, count, vnum, socket0, socket1, socket2, attrtype0, attrvalue0, attrtype1, attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6"
#ifdef ENABLE_PREMIUM_PRIVATE_SHOP
                    ", price, shop_id "
#endif
            "FROM item%s WHERE `owner_id`=%d AND `window`='PRIVATE_SHOP'", GetTablePostfix(), pi->player_id);

Şöyle değiştirebilir misiniz?
C++:
            snprintf(szQuery, sizeof(szQuery), "SELECT id, `window`+0, pos, count, vnum, socket0, socket1, socket2, attrtype0, attrvalue0, attrtype1, attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6"
#ifdef ENABLE_PREMIUM_PRIVATE_SHOP
                    ", price, shop_id "
#endif
            "FROM item%s WHERE `owner_id`=%d AND `window`='PRIVATE_SHOP'", GetTablePostfix(), pi->player_id);
 
düzenleme : bu kısımda veriyormuş hatayı, görmedim;

snprintf(szQuery, sizeof(szQuery), "SELECT id, window+0, pos, count, vnum, socket0, socket1
 
Şu kodu;
C++:
            snprintf(szQuery, sizeof(szQuery), "SELECT id, window+0, pos, count, vnum, socket0, socket1, socket2, attrtype0, attrvalue0, attrtype1, attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6"
#ifdef ENABLE_PREMIUM_PRIVATE_SHOP
                    ", price, shop_id "
#endif
            "FROM item%s WHERE `owner_id`=%d AND `window`='PRIVATE_SHOP'", GetTablePostfix(), pi->player_id);

Şöyle değiştirebilir misiniz?
C++:
            snprintf(szQuery, sizeof(szQuery), "SELECT id, `window`+0, pos, count, vnum, socket0, socket1, socket2, attrtype0, attrvalue0, attrtype1, attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6"
#ifdef ENABLE_PREMIUM_PRIVATE_SHOP
                    ", price, shop_id "
#endif
            "FROM item%s WHERE `owner_id`=%d AND `window`='PRIVATE_SHOP'", GetTablePostfix(), pi->player_id);
SYSERR: Mar 19 16:16:39 :: DirectQuery: AsyncSQL::DirectQuery : mysql_query error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'window+0,pos,count,vnum,socket0,socket1,socket2,attrtype0,attrvalue0,attrtype1,a' at line 1
query: SELECT id, owner_id, window+0,pos,count,vnum,socket0,socket1,socket2,attrtype0,attrvalue0,attrtype1,attrvalue1,attrtype2,attrvalue2,attrtype3,attrvalue3,attrtype4,attrvalue4,attrtype5,attrvalue5,attrtype6,attrvalue6,applytype0,applyvalue0,applytype1,applyvalue1,applytype2,applyvalue2,applytype3,applyvalue3,applytype4,applyvalue4,applytype5,applyvalue5,applytype6,applyvalue6,applytype7,applyvalue7, price, shop_id FROM player.item WHERE shop_id=32

düzenleme : bu kısımda veriyormuş hatayı, görmedim;

snprintf(szQuery, sizeof(szQuery), "SELECT id, window+0, pos, count, vnum, socket0, socket1
Ne demek istedin anlamadım?

Arkadaşlar bu snprintf kısmına ` sembolü eklediğimizde oyuna start verince direk syser veriyor üstteki gibi ama snprinf kısmına koymadığımda syser vermiyor offline pazarı kurunca bu kısımdan syser veriyor "FROM item%s WHERE `owner_id`=%d AND `window`='PRIVATE_SHOP'", GetTablePostfix(), pi->player_id);
 
Ne demek istedin anlamadım?

Kod:
SYSERR: Mar 19 16:16:39 :: DirectQuery: AsyncSQL::DirectQuery : mysql_query error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'window+0,pos,count,vnum,socket0,socket1,socket2,attrtype0,attrvalue0,attrtype1,a' at line 1


bu kısımda veriyor hatayı.

"SELECT id, window+0

kısmında ki window+0 ı şu şekilde değiştirip dene : `window+0`


mysql 8.0 yerine mariadb 10.5 daha iyi aslında..
 
Kod:
SYSERR: Mar 19 16:16:39 :: DirectQuery: AsyncSQL::DirectQuery : mysql_query error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'window+0,pos,count,vnum,socket0,socket1,socket2,attrtype0,attrvalue0,attrtype1,a' at line 1


bu kısımda veriyor hatayı.

"SELECT id, window+0

kısmında ki window+0 ı şu şekilde değiştirip dene : `window+0`


mysql 8.0 yerine mariadb 10.5 daha iyi aslında..
Bu söylediğini üstte yazdım az önce dediğin gibi o kısım öyle olacak ama sonrasında ise;

FROM item%s WHERE owner_id=%d AND window='PRIVATE_SHOP'", GetTablePostfix(), pi->player_id);

bu kısımda syser veriyor.
 
o kısımı şu şekilde değiştir : `window`='PRIVATE_SHOP'"
Kod:
SYSERR: Mar 19 16:45:08 :: DirectQuery: AsyncSQL::DirectQuery : mysql_query error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'window+0,pos,count,vnum,socket0,socket1,socket2,attrtype0,attrvalue0,attrtype1,a' at line 1

query: SELECT id, owner_id, window+0,pos,count,vnum,socket0,socket1,socket2,attrtype0,attrvalue0,attrtype1,attrvalue1,attrtype2,attrvalue2,attrtype3,attrvalue3,attrtype4,attrvalue4,attrtype5,attrvalue5,attrtype6,attrvalue6,applytype0,applyvalue0,applytype1,applyvalue1,applytype2,applyvalue2,applytype3,applyvalue3,applytype4,applyvalue4,applytype5,applyvalue5,applytype6,applyvalue6,applytype7,applyvalue7, price, shop_id FROM player.item WHERE shop_id=32


Hiç pazarı bile kurmadan ch start verince bunu veriyor.
 
En son bir moderatör tarafından düzenlenmiş:
Anydesk ile bağlandıktan sonra kodları inceledim. Birden fazla dosyada hata meydana geliyor.

Kod:
SYSERR: Mar 19 17:08:59 :: DirectQuery: AsyncSQL::DirectQuery : mysql_query error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'window = 'PRIVATE_SHOP' and owner_id=12' at line 1
query: SELECT id FROM item WHERE window = 'PRIVATE_SHOP' and owner_id=12
Bu hatanın kaynağı game/src/char.cpp altındaki şu koddan kaynaklı
C++:
    std::auto_ptr<SQLMsg> pmsg(DBManager::instance().DirectQuery("SELECT id FROM item%s WHERE window = 'PRIVATE_SHOP' and owner_id=%d",
                get_table_postfix(), GetPlayerID()));

Şu şekilde değiştirdik
C++:
    std::auto_ptr<SQLMsg> pmsg(DBManager::instance().DirectQuery("SELECT id FROM item%s WHERE `window` = %d'' and owner_id=%d",
                get_table_postfix(), GetPlayerID(), PRIVATE_SHOP));


Şu hata için ise;
Kod:
SYSERR: Mar 19 17:25:55 :: DirectQuery: AsyncSQL::DirectQuery : mysql_query error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'window+0,pos,count,vnum,socket0,socket1,socket2,attrtype0,attrvalue0,attrtype1,a' at line 1
query: SELECT id, owner_id, window+0,pos,count,vnum,socket0,socket1,socket2,attrtype0,attrvalue0,attrtype1,attrvalue1,attrtype2,attrvalue2,attrtype3,attrvalue3,attrtype4,attrvalue4,attrtype5,attrvalue5,attrtype6,attrvalue6,applytype0,applyvalue0,applytype1,applyvalue1,applytype2,applyvalue2,applytype3,applyvalue3,applytype4,applyvalue4,applytype5,applyvalue5,applytype6,applyvalue6,applytype7,applyvalue7, price, shop_id FROM player.item WHERE shop_id=32
game/src/shop_manager.cpp dosyasında şu kodu;
C++:
        snprintf(queryStr, sizeof(queryStr),
            "SELECT id, owner_id, window+0,pos,count,vnum,socket0,socket1,socket2,attrtype0,attrvalue0,attrtype1,attrvalue1,attrtype2,attrvalue2,attrtype3,attrvalue3,attrtype4,attrvalue4,attrtype5,attrvalue5,attrtype6,attrvalue6,applytype0,applyvalue0,applytype1,applyvalue1,applytype2,applyvalue2,applytype3,applyvalue3,applytype4,applyvalue4,applytype5,applyvalue5,applytype6,applyvalue6,applytype7,applyvalue7"
            ", transmutation, price, shop_id "
            "FROM player.item WHERE shop_id=%u", dwShopVid);


Şöyle değiştirdik;
C++:
        snprintf(queryStr, sizeof(queryStr),
            "SELECT id, owner_id, window+0,pos,count,vnum,socket0,socket1,socket2,attrtype0,attrvalue0,attrtype1,attrvalue1,attrtype2,attrvalue2,attrtype3,attrvalue3,attrtype4,attrvalue4,attrtype5,attrvalue5,attrtype6,attrvalue6,applytype0,applyvalue0,applytype1,applyvalue1,applytype2,applyvalue2,applytype3,applyvalue3,applytype4,applyvalue4,applytype5,applyvalue5,applytype6,applyvalue6,applytype7,applyvalue7"
            ", transmutation, price, shop_id "
            "FROM player.item WHERE shop_id=%u", dwShopVid);

db/src/ClientManager.cpp dosyasında ise
Şu kodu;
C++:
            snprintf(szQuery, sizeof(szQuery), "SELECT id, window+0, pos, count, vnum, socket0, socket1, socket2, attrtype0, attrvalue0, attrtype1, attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6"
#ifdef ENABLE_PREMIUM_PRIVATE_SHOP
                    ", price, shop_id "
#endif
            "FROM item%s WHERE `owner_id`=%d AND `window`='PRIVATE_SHOP'", GetTablePostfix(), pi->player_id);

Şöyle değiştirdik
C++:
            snprintf(szQuery, sizeof(szQuery), "SELECT id, `window`+0, pos, count, vnum, socket0, socket1, socket2, attrtype0, attrvalue0, attrtype1, attrvalue1, attrtype2, attrvalue2, attrtype3, attrvalue3, attrtype4, attrvalue4, attrtype5, attrvalue5, attrtype6, attrvalue6"
#ifdef ENABLE_PREMIUM_PRIVATE_SHOP
                    ", price, shop_id "
#endif
            "FROM item%s WHERE `owner_id`=%d AND `window`=%d", GetTablePostfix(), pi->player_id, PRIVATE_SHOP);


Daha sonra item tablosunun window sütununa PRIVATE_SHOP değerini ekledik.


MySQL 8.0 sürümünde querylerin bazı yerlerini güncelleştirmek gerekiyor. Şu videoyu izleyerek bilgi edinebilirsiniz.



Bu konunun çözümüne katkı sağlayan tüm üyelerimize teşekkürler.. El birliği ile bir sorunu daha hallettik.
 
Çözüm
Durum
İçerik kilitlendiği için mesaj gönderimine kapatıldı.
Geri
Üst