CakeFest 2024: The Official CakePHP Conference

Öntanımlı Sabitler

Buradaki sabitler bu eklenti için tanımlanmış olup, sadece eklentinin PHP içinde derlenmiş olması veya çalışma anında dinamik olarak yüklenmesi halinde kullanılabilir.

mysql_connect() ve mysql_pconnect() işlevleri için fazladan istemci seçenekleri tanımlanabilmektedir. Aşağıdaki sabitler tanımlanmıştır:

MySQL istemci sabitleri
Sabit Açıklama
MYSQL_CLIENT_COMPRESS Sıkıştırma protokolü kullan
MYSQL_CLIENT_IGNORE_SPACE İşlev isimlerinden sonra boşluğa izin ver
MYSQL_CLIENT_INTERACTIVE Bağlantıyı kapatmadan önce (wait_timeout yerine) interactive_timeout saniye hareketsizliğe izin ver. İstemci oturumunun wait_timeout değişkeninin değeri oturumun interactive_timeout değişkenine atanır.
MYSQL_CLIENT_SSL SSL şifrelemesi kullan. Bu seçenek MySQL istemci kütüphanesinin sadece 4.x veya daha yeni sürümlerinde kullanılabilir. 3.23.x sürümü hem PHP 4 ile hem de PHP 5'in Windows çalıştırılabilir dosyaları ile birlikte gelir.

mysql_fetch_array() işlevi farklı türlerdeki sonuç dizileri için bir sabit kullanır. Şu sabitler tanımlanmıştır:

MySQL veri çekme sabitleri
Sabit Açıklama
MYSQL_ASSOC Sütunlar indisi alan adı olan bir dizi olarak döndürülür.
MYSQL_BOTH Sütunlar, hem alan adı anahtarlı hem de sayısal indisli bir dizi olarak döndürülür.
MYSQL_NUM Sütunlar, alanları sayısal indisli bir dizi olarak döndürülür. Bu indis 0'dan başlar.

add a note

User Contributed Notes 3 notes

up
8
pcdinh at phpvietnam dot net
14 years ago
Other client flags extracted from MySQL client source

#define CLIENT_LONG_PASSWORD 1 /* new more secure passwords */
#define CLIENT_FOUND_ROWS 2 /* Found instead of affected rows */
#define CLIENT_LONG_FLAG 4 /* Get all column flags */
#define CLIENT_CONNECT_WITH_DB 8 /* One can specify db on connect */
#define CLIENT_NO_SCHEMA 16 /* Don't allow database.table.column */
#define CLIENT_COMPRESS 32 /* Can use compression protocol */
#define CLIENT_ODBC 64 /* Odbc client */
#define CLIENT_LOCAL_FILES 128 /* Can use LOAD DATA LOCAL */
#define CLIENT_IGNORE_SPACE 256 /* Ignore spaces before '(' */
#define CLIENT_PROTOCOL_41 512 /* New 4.1 protocol */
#define CLIENT_INTERACTIVE 1024 /* This is an interactive client */
#define CLIENT_SSL 2048 /* Switch to SSL after handshake */
#define CLIENT_IGNORE_SIGPIPE 4096 /* IGNORE sigpipes */
#define CLIENT_TRANSACTIONS 8192 /* Client knows about transactions */
#define CLIENT_RESERVED 16384 /* Old flag for 4.1 protocol */
#define CLIENT_SECURE_CONNECTION 32768 /* New 4.1 authentication */
#define CLIENT_MULTI_STATEMENTS 65536 /* Enable/disable multi-stmt support */
#define CLIENT_MULTI_RESULTS 131072 /* Enable/disable multi-results */
#define CLIENT_REMEMBER_OPTIONS (((ulong) 1) << 31)
up
4
frak at gingerhq dot net
12 years ago
If you're using stored procedures and mysql_error() returns "PROCEDURE storedProcedureName can't return a result set in the given context", you need to pass an additional flag (CLIENT_MULTI_RESULTS) to mysql_connect() as such:
mysql_connect($hostname, $username, $password, true, 131072);

Some other sources say that you should use 65536. 65536 is actually the flag to allow multiple statements in a single mysql_query(), and is a security issue. The reason it allows you to receive results from stored procedures is because it implies 131072. To be safe, use 131072 over 65536.
up
-5
Contact at LinuxIntro dot com
15 years ago
When you connect and expect to use a stored procedure,you must pass a special flag to MySQL via the connect command, otherwise you will not get the results returned, and it will result in this error:
PROCEDURE AlexGrim.GetStats_ForumCategories can't return a result set in the given context

To fix this, change you connection string, adding ",false,65536" as the last 2 fields:
$this->con = mysql_connect($this->h,$this->u,$this->p,false,65536);
To Top