I am trying to insert data using the C API.


Particulars:
OS: Mac OS X 10.3 (7A179)
MySQL: MySQL 4.1.0-alpha
table type: tried both MyISAM and InnoDB

I have a table:

mysql> describe testtable;
+--------+---------+-------------------+------+-----+---------+-------+
| Field  | Type    | Collation         | Null | Key | Default | Extra |
+--------+---------+-------------------+------+-----+---------+-------+
| _PK    | int(11) | binary            |      | PRI | 0       |       |
| first  | char(3) | latin1_swedish_ci | YES  |     | NULL    |       |
| second | char(3) | latin1_swedish_ci | YES  |     | NULL    |       |
| third  | char(3) | latin1_swedish_ci | YES  |     | NULL    |       |
+--------+---------+-------------------+------+-----+---------+-------+
4 rows in set (0.00 sec)

Note that the first, second, and third columns have 3 characters of space.

When I do:

        printf("insert: %s\n", insert);
        int result = mysql_query(one, insert);
        printf("info: %s\n", mysql_info(one));


I get:


insert: INSERT INTO testtable (_PK,first,second,third) VALUES (1,'AAAXXX','BBB','CCC')
info: (null)
insert: INSERT INTO testtable (_PK,first,second,third) VALUES (2,'DDD','EEE','FFF')
info: (null)
insert: INSERT INTO testtable (_PK,first,second,third) VALUES (3,'GGG','HHHXXX','III')
info: (null)


Note that the value in the first insert, 'AAAXXX', is too long to fit. As is 'HHHXXX' in the third insert. And indeed, I see:

mysql> select * from testtable;
+-----+-------+--------+-------+
| _PK | first | second | third |
+-----+-------+--------+-------+
|   1 | AAA   | BBB    | CCC   |
|   2 | DDD   | EEE    | FFF   |
|   3 | GGG   | HHH    | III   |
+-----+-------+--------+-------+
3 rows in set (0.00 sec)

So, why is mysql_info not giving me any information about the data loss that is going on here? Is that not information that might be of interest?

Is there some other call I have to make that will "prepare" for the mysql_info call? The doc does not seem to indicate this, but one never knows.

thanx - ray


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



Reply via email to