MYSQL_FIELD

2005-02-23 Thread Mohsen Pahlevanzadeh
Dears,
My code is :
void  CMysql::ReadingFld(const char *tblname)
{
 MYSQL_RES *fldres;
 int i;
 fldres=mysql_list_fields(connection2db,tblname,%);
 ptr.srcFldNumber=mysql_num_fields(fldres);
 FieldsRow=mysql_fetch_fields(fldres);
  for (i=0;iptr.srcFldNumber;i++)
   cout  FieldsRow[i];
}//end of RedingFld method

I defined FieldsRow from MYSQL_FIELD type at my class.
Now,I receive following error:
[EMAIL PROTECTED] sql2sql]# make
g++ -c  -I/usr/include -I/usr/include/mysql  sql2sql.cpp;
sql2sql.cpp: In member function `void CMysql::ReadingFld(const char*)':
sql2sql.cpp:208: no match for `MYSQL_FIELD = MYSQL_FIELD*' operator
/usr/include/mysql/mysql.h:92: candidates are: st_mysql_field
   st_mysql_field::operator=(const st_mysql_field)
sql2sql.cpp:210: no match for `MYSQL_FIELD [int]' operator
make: *** [sql2sql.o] Error 1

Please help me


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Bug: MYSQL_FIELD-flags indicates NOT NULL with aggregates

2003-01-24 Thread Matt Solnit
This looks like it was generated using mysqlbug, but actually I took
another post and pasted in the values.

Description:
The mysql_fetch_field() function returns a MYSQL_FIELD structure with
the flags field set to a value including NOT_NULL_FLAG even if the field
is an aggregate, if that aggregate is on the primary key.

If there are no rows in the table, then MAX(pri_key_column) will return
NULL.  However, the MYSQL_FIELD structure will indicate that the
MAX(pri_key_column) field does not allow NULL.

If the column is not a primary key, but is NOT NULL, then the
MYSQL_FIELD flags will correctly indicate that the aggregate can allow
NULL.

How-To-Repeat:
In MySQL: CREATE TABLE foo (bar int PRIMARY KEY);

In C:
  MYSQL *cnn = mysql_init(NULL);
  mysql_real_connect(cnn, NULL, NULL, NULL, test, 0, NULL, 0);

  const char* select_query = SELECT MAX(bar) FROM foo;
  mysql_query(cnn, select_query);
  MYSQL_RES* res = mysql_store_result(cnn);

  MYSQL_FIELD* fld = mysql_fetch_field(res);
  char* name = strdup(fld-name);
  bool isNotNull = ((fld-flags  NOT_NULL_FLAG)  0);
  printf(column `%s`: notnull=%d\n, name, isNotNull);

  MYSQL_ROW row = mysql_fetch_row(res);
  printf(value: %s, row[0] ? row[0] : NULL);

  mysql_close(cnn);


Fix:

None.

Originator:Matt Solnit
Organization: Iteration Software, Inc. http://www.iteration.com
Release:   mysql-4.0.9-gamma (Binary distribution) 
Environment:

System: Windows XP Professional
Architecture: Pentium IV

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




help: MYSQL_FIELD

2002-03-31 Thread James Gosnell

Is there a way I can save the members that I manipulate in the 
MYSQL_FIELD struct?

MYSQL_FIELD *field;
field-name = newcolumnname;

How could I save this as the new column name? Thanks

-- 

Romans 12:9 Let love be without hypocrisy. Abhor what is evil. Cling to 
what is good.


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




SET type columns and MYSQL_FIELD-length

2001-05-03 Thread Zak Greant

Good Day!

I am working on the MySQL section of a reference manual for PHP and need to
confirm one small detail on the length of SET type columns.

It looks like the MYSQL_FIELD-length value for SET columns is the length of
a string containing the SET elements separated by commas.

Is this right?


Thank You!

Zak Greant
Freelance Designer / Programmer / Writer

PHP QA Team Member
http://qa.php.net/

Am I working on a project for or with you?
Check http://calendar.yahoo.ca/jagreant



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php