summaryrefslogtreecommitdiff
path: root/ext/pdo_sqlite/sqlite_driver.c
diff options
context:
space:
mode:
authorWez Furlong <wez@php.net>2005-02-26 17:27:51 +0000
committerWez Furlong <wez@php.net>2005-02-26 17:27:51 +0000
commit2c5b2fc105bd6af6571c2bd39d2785c627c6e578 (patch)
tree2f8587ed4b072b8fc8c10e38db4781f6477b53d5 /ext/pdo_sqlite/sqlite_driver.c
parent31239f2130050f8506e08b01ce1364db3a1573ac (diff)
downloadphp-git-2c5b2fc105bd6af6571c2bd39d2785c627c6e578.tar.gz
Alan: moved your fields away, but reserved you a pointer.
Changed PDO::lastInsertId() to have following proto: string PDO::lastInsertId([string name]) this allows arbitrary unique identitifers to be returned from the driver. The optional name parameter is for databases that require additional contextual information to be able to return the correct identifier. None currently use it, but pgsql will be on the list of drivers that do.
Diffstat (limited to 'ext/pdo_sqlite/sqlite_driver.c')
-rw-r--r--ext/pdo_sqlite/sqlite_driver.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/ext/pdo_sqlite/sqlite_driver.c b/ext/pdo_sqlite/sqlite_driver.c
index 4810cd0da3..3fe9426e3c 100644
--- a/ext/pdo_sqlite/sqlite_driver.c
+++ b/ext/pdo_sqlite/sqlite_driver.c
@@ -156,11 +156,14 @@ static long sqlite_handle_doer(pdo_dbh_t *dbh, const char *sql, long sql_len TSR
}
}
-static long pdo_sqlite_last_insert_id(pdo_dbh_t *dbh TSRMLS_DC)
+static char *pdo_sqlite_last_insert_id(pdo_dbh_t *dbh, const char *name, unsigned int *len TSRMLS_DC)
{
pdo_sqlite_db_handle *H = (pdo_sqlite_db_handle *)dbh->driver_data;
-
- return (long) sqlite3_last_insert_rowid(H->db);
+ char *id;
+
+ id = php_pdo_int64_to_str(sqlite3_last_insert_rowid(H->db) TSRMLS_CC);
+ *len = strlen(id);
+ return id;
}
/* NB: doesn't handle binary strings... use prepared stmts for that */